Timeout Issues

openclinica nginx-forum at nginx.us
Thu Sep 22 15:49:20 UTC 2011


Hi All,

I submitted this originally through the lists but I noticed it did not
create a topic here for it. So I am adding it as a topic, I hope this
acceptable.

Hi All,

Ok I am having issues with NGINX and it timing out. My scenario is that
I am using NGINX as a web server front end for my application. I have
two folder being served as alias’s for static content and one location
doing a proxy_pass to a java server. 

My issue is that on one of the request that goes through the proxy_pass
to the local java web server will time out through nginx within 10
minutes. The timeout is a browser timeout. It takes 11-12 minutes to
load the page without nginx, so I need nginx to not kill the session
until that time has passed. I have tried every timeout setting
imaginable that I could find and I still get a browser timeout at 10
minutes. Note this is an SSL connection, the test without nginx in the
way was also an SSL connection.

Below are my configs, note all the timeout options have been slowly
added over time and lots of testing.....they are not my wanted scenario
but I am trying to figure out how this is done.

NGINX.conf

user www-data;
worker_processes  4;

error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
    # multi_accept on;
}

http {
    include       /etc/nginx/mime.types;

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

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  900 900;
 client_body_timeout      900;
  client_header_timeout    900;
  send_timeout             900;


    tcp_nodelay        on;

    gzip  on;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";
    gzip_types text/plain text/html text/css text/javascript image/png
image/x-icon application/x-javascript application/xml image/gif;
    
    ssl_session_cache    shared:SSL:100k;
    ssl_session_timeout  20m;


    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

Site Conf

server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        access_log  /var/log/nginx/80-app.access.log;
        error_log  /var/log/nginx/80-app.error.log;

        location / {
            rewrite ^/(.*)$ https://$host/$1 redirect;
        }

        error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
}
server {        
        listen       443;
        server_name  localhost; 


        access_log  /var/log/nginx/app.access.log;
        error_log  /var/log/nginx/app.error.log;

        ssl                  on;
        ssl_certificate      /usr/local/oc/install/server.com.crt;
        ssl_certificate_key  /usr/local/oc/install/server.key;

#        fail_timeout 3600s;
    keepalive_timeout  900 900;
 client_body_timeout      900;
  client_header_timeout    900;
  send_timeout             900;
        # directly serve the static files in the `images` directory
        location ~ ^/APP/includes/(.*)$ {
            # add future expiry date to force caching of the file on the
client
            expires max;
            add_header Cache-Control "public";
            alias /usr/local/tomcat/webapps/APP/includes/$1;
        }

        location ~ ^/APP/images/(.*)$ {
            # add future expiry date to force caching of the file on the
client 
            expires max;
            add_header Cache-Control "public";
            alias /usr/local/tomcat/webapps/APP/images/$1;
        }
        # pass all other requests to Tomcat
        location /APP {
            proxy_read_timeout 3600s;
            proxy_connect_timeout 3600s;
            proxy_send_timeout 3600s;

            proxy_pass http://127.0.0.1:8080/APP;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
        }
}


Any help is greatly appreciated. I wouldn’t even mind if it is
possible to disable timeout all together just as a test.

Thanks,
Shaun

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



More information about the nginx mailing list