nginx访问502 gateway,*1 connect() failed (111: Connection refused) while connecting to upstream
生活随笔
收集整理的這篇文章主要介紹了
nginx访问502 gateway,*1 connect() failed (111: Connection refused) while connecting to upstream
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
安裝好nginx,php環(huán)境后,配置虛擬主機(jī),結(jié)果訪問后就報(bào)502 gateway,查看日志文件后,顯示錯(cuò)誤如下:
2019/04/29 16:24:39 [error] 19433#19433: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.52, server: 192.168.1.222, request: "GET / HTTP/1.1"解決方案,先查看下php-fpm是否啟動(dòng),然后查看虛擬主機(jī)配置中的 root 配置
server {listen 80;server_name 192.168.1.222;charset utf-8;location / {root /data/wwwroot;index index.php index.html index.htm;}location ~ \.php$ {#注意這里root配置與當(dāng)前server下的root保持一致#我的報(bào)錯(cuò)原因是我把root這項(xiàng)給刪除root /data/wwwroot;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;} }然后重啟下nginx就可以訪問了。
轉(zhuǎn)載于:https://www.cnblogs.com/jkko123/p/10791283.html
總結(jié)
以上是生活随笔為你收集整理的nginx访问502 gateway,*1 connect() failed (111: Connection refused) while connecting to upstream的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 《象与骑象人》总结一
- 下一篇: 彻底理解maven