Centos + Nginx sometimes time out requests

June 7, 2014 1.8k views
Hello, I've Nginx running on a droplet working succefully with SSL. But sometimes, when I load the website it never finishes and shows a request time out.. but sometimes it works like a charm! Here's my Nginx server configuration: server { listen 80; server_name; rewrite ^ https://$server_name$request_uri? permanent; } server{ listen 443 ssl; server_name MYDOMAIN; ssl_certificate /etc/nginx/ssl/ssl.crt; ssl_certificate_key /etc/nginx/ssl/; #ssl_session_cache shared:SSL:1m; #ssl_session_timeout 5m; #ssl_ciphers HIGH:!aNULL:!MD5; #ssl_prefer_server_ciphers on; #charset koi8-r; #access_log /var/log/nginx/log/host.access.log main; location / { root /usr/share/nginx/html; index index.php index.html index.htm; } 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 /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on # #location ~ \.php$ { # proxy_pass; #} # pass the PHP scripts to FastCGI server listening on # location ~ \.php$ { root html; fastcgi_pass; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} }
1 Answer
Are you seeing anything in your Nginx error logs? Most likely, you just want to increase the max timeout. Inside the "location ~ \.php$" block add:

fastcgi_read_timeout 600;
Have another answer? Share your knowledge.