nginx是杀了我..所以现在我有502坏网关。 错误日志说:
2016/10/12 17:39:53 [info] 3023#0: *464 client closed connection while waiting for request, client: 127.0.0.1, server: 0.0.0.0:443 2016/10/12 17:39:53 [info] 3023#0: *465 client closed connection while waiting for request, client: 127.0.0.1, server: 0.0.0.0:443 2016/10/12 17:39:55 [error] 3023#0: *459 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: local.beerhawk.co.uk, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "local.mydomain.co.uk"
我的ngninx conf文件现在看起来像这样:
#user RobDee; worker_processes auto; #error_log logs/error.log; #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; error_log logs/error.log; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name default; #charset koi8-r; #access_log logs/host.access.log main; location / { root /Users/RobDee/workspace/beerhawk/web; index index.html index.htm; } # HTTPS server server { listen 443 ; server_name local.mydomain.co.uk local.beer.telegraph.co.uk; ssl on; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_certificate /usr/local/etc/nginx/cert.pem; ssl_certificate_key /usr/local/etc/nginx/cert.key; gzip_disable "msie6"; gzip_types text/plain application/xml application/x-javascript text/css application/json text/javascript; access_log /usr/local/var/log/nginx/access.log; error_log /usr/local/var/log/nginx/error.log debug; log_not_found off; root /Users/RobDee/workspace/beerhawk/web; location /.htpasswd { return 403; } location ~ \.css { root /Users/RobDee/workspace/beerhawk/web; expires max; } location ~* \.(jpg|jpeg|png|gif|ico|js|woff|woff2|ttf)$ { root /Users/RobDee/workspace/beerhawk/web; access_log off; expires max; } location ~* \.(js|css)$ { expires 1y; log_not_found off; } location / { try_files $uri $uri/ /app_dev.php$is_args$args; index index.php app_dev.php; } location ~ \.php$ { #root /Users/RobDee/workspace/beerhawk/web; fastcgi_pass 127.0.0.1:9000; fastcgi_index app_dev.php; fastcgi_param SCRIPT_FILENAME $request_filename; include fastcgi_params; #fastcgi_read_timeout 3000; } } include servers/*; }
我不知道我做错了什么…任何人都可以帮助我请
你的申请需要多长时间来回复?
当客户端超时连接时,我们发现类似于这些的错误:
2016/10/12 17:39:53 [info] 3023#0: *465 client closed connection while waiting for request, client: 127.0.0.1, server: 0.0.0.0:443
例如,如果清漆实例在10秒内超时,而nginx很乐意等待30秒的PHP响应,则清漆会在Nginx响应之前终止连接。
错误upstream prematurely closed connection可能是nginx终止连接到PHP。 不是100%肯定,因为我不记得处理这个错误太多!
希望有助于OP 🙂