針對配置php的情況:
linux服務器一般提示這個
connect() to unix:/tmp/php-cgi.sock failed (2: No such file or directory) while connecting to upstream, client: x.x.x.x, server: xxx.xxx.xxx, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi.sock:"
win服務器一般提示
connect() failed (111: Connection refused) while connecting to upstream, client: x.x.x.x, server: xxx.xxx.xxx, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000"
這兩個提示,一般就是配置文件錯誤。我們配置nginx支持php時,會有一個
以前,不是配置成:fastcgi_pass unix:/tmp/php-cgi.sock; (linux機器)
就是配置成:fastcgi_pass 127.0.0.1:9000; (win機器)
結(jié)果就報以上錯誤。此時,這個配置成什么,有系統(tǒng)決定形式,但具體內(nèi)容,要看php對應的php-fpm的配置文件
/www/server/php/73/etc/php-fpm.conf (我機器的位置)
要看這個文件的內(nèi)容,編輯該文件,找到 listen = /tmp/php-cgi-73.sock 這一行。將等于號后邊的內(nèi)容復制到nginx的配置文件里,替換fastcgi_pass后邊的值。
然后重啟nginx即可。
而此處我同時還配置了jsp的訪問。那么,也報了幾乎同樣的錯誤。其實,最終發(fā)現(xiàn),是tomcat的配置端口寫錯了。
總之,有報錯,就一定有配置寫錯。仔細找找可能錯的地方。一般就是路徑配置,和參數(shù)文件的指定,在一個就是端口。保證這三個地方?jīng)]問題。一般就不會有太大問題。