• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Upstream timeout issues

Rooked

New Pleskian
Hi,

I'm experience issues with a specific website that sometimes returns time out / upstream errors. This issue pops up every few days resulting in my entire website not loading and, after a while, returning a HTTP 504 timeout message. This stays until I restart the PHP engine (I usually change the PHP version).

I've been experiencing this issue for a while and tried many fixes but since the error only happens occassionaly it's hard to debug.

The error message from my proxy_error_log file (anonymised):

Code:
2019/12/12 10:16:19 [error] 30624#0: *81917 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 0.0.0.0, server: example.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:///var/www/vhosts/system/example.com/php-fpm.sock", host: "example.com"

/etc/nginx/nginx.conf
Code:
#user  nginx;
worker_processes  1;

#error_log  /var/log/nginx/error.log;
#error_log  /var/log/nginx/error.log  notice;
#error_log  /var/log/nginx/error.log  info;

#pid        /var/run/nginx.pid;

include /etc/nginx/modules.conf.d/*.conf;

events {
    worker_connections  1024;
}


http {
    include   mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    #tcp_nodelay        on;

    #gzip  on;
    #gzip_disable "MSIE [1-6]\.(?!.*SV1)";

    server_tokens off;

    include /etc/nginx/conf.d/*.conf;
}

# override global parameters e.g. worker_rlimit_nofile
include /etc/nginx/*global_params;

  • This website is the only one experiencing this issue. Other sites on the same server are still online & loading while this happens.
  • Site runs on Nginx without apache (proxy mode = off)
    • PHP 7.3.13, FPM application served by nginx
  • Many online solutions recommend increasing the timeout values (proxy_connect_timeout). I've tried this but just resulted in it taking longer before the HTTP 504 error shows and doesn't solve the actual issue.
  • CentOS Linux 7.7.1908 (Core)‬, Plesk Obsidian Version 18.0.21 Update #5
Does anyone know how I can resolve this issue or debug it better?
 
your details say nothing just that you have a site who's 504. My guess is your server's out of resources and can't handle it.
Have you seen resource usage? debug your code. monitor proccesses 504 can happen for many reasons
 
Hi, thanks for your reply!

The odd thing is other websites on this server are still loading while this site experiences this issue. I can't spot anything strange in resource usage (CPU, Memory, Disk) graphs either. Is there anything specific I should be looking for?

The site in question doesn't get much traffic nor does it do anything resource heavy. It's just some pages connected to a database.
 
Sorry for not replying faster i've not had much time. Just wanted to check if you've fixed this problem? i see that you didn't got any other reply that's because as i said ppl can't do much against 504 without having to see what are you running and full server logs. However.

Make sure that the time out is not caused by some curl call connecting to a external website.
Make sure cloudflare is turned off during the time you test it because cloudflare has its own time out time which will throw the timeout page even if cloudflare can't connect on your site for x time.
Make sure php-fpm and apache is running well and try switch from nginx as proxy to proccess directly with nginx without apache.
 
Back
Top