Nginx server : upstream timed out (10060: A connection attempt failed)
Solution 1
in my case, I was running my Server inside a FreeBSD Jail (Nginx 1.6.2, PHP/5.6.6) using TCP-Port instead of socket. The problem resolved changing two settings in my
php-fpm.conf
file:
;listen.allowed_clients = 127.0.0.1 # comment out to listen to any
listen = 9000 # No IP-Address
It worked.
Solution 2
This issue is due to nginx timing out before it gets a response from the backend (php). There are a few timeouts that be set in nginx to change this.
The default "response" timeout from fastcgi is 60s. You have it at 600s, which might not be enough time.
fastcgi_read_timeout 60s;
Nginx Documentation : FastCGI Module
Admin
Updated on June 26, 2022Comments
-
Admin almost 2 years
We are running a service which will migrate the issues from Jira to test link.So I am using nginx server to communicate with mysql database and to run the testlink in the browser.
when I import more no of issue suddenly the nginx server get closed automatically.I am running my service and nginx server in Windows server 2008 R2 standard and 64 bit OS. I checked the error.log file in the
C:\nginx\logs
and found the error asupstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 192.168.27.151, server: localhost, request: "GET /testlink/lib/general/frmWorkArea.php?feature=reqSpecMgmt HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "wo-qatestlink01", referrer: "http://wo-qatestlink01/testlink/lib/general/navBar.php?tproject_id=0&tplan_id=0&updateMainPage=1"
Thanks.
Log File
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; 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 logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; proxy_read_timeout 600; #gzip on; server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.php; fastcgi_read_timeout 600; #The above line has been added and below line has been commented to use the php code. #index 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 html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # ########## Code added during Configuration By Anthony ################ location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME c:/nginx/html/$fastcgi_script_name; include fastcgi_params; } ###################################################################### #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$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; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }