Search code examples
nginxfastcgihttp-status-code-504

504 Gateway Time-out with Nginx / GlassFish


Many answers on SO mention FastCGI params to prevent timeout. I tried to follow these advice (see the fastcgi params below), but it does not prevent the timeout.
I use Nginx to redirect to a glassfish app on port 8080. My nginx.conf:

http {

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 360;
        types_hash_max_size 2048;
        # server_tokens off;
        ...
}

And my site.conf:

server {
        listen       80;
        server_name server.net www.server.net;

        location /Server-1.0-SNAPSHOT/ {
           proxy_pass    http://localhost:8080/Server-1.0-SNAPSHOT/;
           proxy_set_header X-Real-IP $remote_addr;
           fastcgi_read_timeout 360;
        }
}

I am quite amateur on server config so any detailed how-to would be appreciated!


Solution

  • fastcgi_read_timeout is for fastcgi_pass. As you use proxy_pass you need proxy_read_timeout.