我想弄清楚为什么我有这么多的错误日志:
[error] 1545#0: *713626 connect() failed (111: Connection refused) while connecting to upstream, client: xx.xx.xx.xx, server: www.example.com, request: "GET / HTTP/1.0", upstream: "fastcgi://127.0.0.1:9000", host: "www.example.com"
所有关于这个错误的post,我已经看到了导致坏的网关错误,但是我已经快速浏览了网站上的许多页面,试图得到错误popup,果然,最新的日志显示这个错误与我的IP。 不过,我从来没有任何问题获得任何页面加载。 这个问题可能是什么?
nginxconfiguration:
worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; # output compression saves bandwidth gzip on; gzip_static on; gzip_http_version 1.1; gzip_vary on; gzip_min_length 1400; gzip_comp_level 9; gzip_proxied any; gzip_types text/plain text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml image/png image/gif image/jpeg image/jpg; gzip_buffers 16 8k; # Disable gzip for certain browsers. gzip_disable âMSIE [1-6].(?!.*SV1)â server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } upstream php { server unix:/var/run/php-fpm/php-fpm.sock; server 127.0.0.1:9000; } include sites-enabled/*.conf; }
网站特定的configuration:
server { server_name www.example.com; root /blah/blah/blah; index index.php; include global/restrictions.conf; include global/wordpress.conf; location ~ \.php$ { include fastcgi.conf; fastcgi_intercept_errors on; fastcgi_pass php; } location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires max; add_header Pragma public; add_header Cache-Control "public, must-revalidate, proxy-revalidate"; log_not_found off; } }
您已经在upstream
块中指定了两台server
。 当一个失败,你会看到在日志中看到的错误,然后nginx尝试另一个。 由于这显然连接成功,你没有看到用户可见的错误,如502或504。
我猜你已经将你的PHP-FPM设置从TCP连接转换到了UNIX域套接字,忘记删除旧的server 127.0.0.1:9000;
线。 如果错误困扰你,那么随时可以这样做。