Unbreakable 90 sec timeout

Hubbitus nginx-forum at nginx.us
Sat Feb 5 01:11:16 MSK 2011


I'm spent half day to googling, reading documentation and try...

I have simple file to test what just sleep 120 second:
echo 'Done';
file_put_contents('test.date', date('c'));

But nginx (binary Debian package) always fired error 504: [code]
504 Gateway Time-out
after 90 seconds timeout.

In try solve problem I set to big values many timeout directives:
        proxy_connect_timeout 600;
        proxy_send_timeout 600;
        proxy_read_timeout 600;
        fastcgi_read_timeout 600;
        client_body_timeout 600;
        client_header_timeout 600;
        send_timeout 600;
        fastcgi_connect_timeout 600;
        fastcgi_send_timeout 600;
but unfortunately it does not helps.

Full config used:
[code]server {
    server_name example.com www.example.com;

        proxy_connect_timeout 1600;
        proxy_send_timeout 1600;
        proxy_read_timeout 1600;

        fastcgi_read_timeout 1600;
        client_body_timeout 1600;
        client_header_timeout 1600;
        send_timeout 1600;

        fastcgi_connect_timeout 1600;
        fastcgi_send_timeout 1600;

    access_log /var/www/site/logs/nginx_access.log;
    error_log /var/www/site/logs/nginx_error.log;

    location / {
        include /etc/nginx/proxy.conf;
        proxy_temp_path /var/nginx/proxy_temp;
        root /var/www/site/www/;

    location ~*
        root /var/www/site/www/;
        access_log off;
        expires 30d;

What is also may be interesting - if directly ask Apache which act there
as frontend - script work. Even via nginx script also run to end - date
in file updated each time despite 504 error produced for user.

What more can I tune?

With best wishes, Pavel Alexeev.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,172262,172262#msg-172262

More information about the nginx mailing list