您好,登錄后才能下訂單哦!
問題描述:
服務器重啟之后,服務器也正常運行,發現網站訪問不了,后來查看nginx 錯誤日志(/var/log/nginx/error.log )
2016/05/13 10:47:32 [error] 7688#0: *8 connect() failed (111: Connection refused) while connecting to upstream, client: ****.****.****.33, server: , request: "GET url HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "****.leyue.com.cn:22080"
后來google,發現類似不少的問題,就整理了一下,基本上有以下三個原因造成這個問題的原因:
>>>php-fpm沒有安裝 >>>php-fpm沒有運行 可以用ps aux | grep 'php-fpm',來查看. [root@dev ~]# ps aux | grep 'php-fpm' root 4570 0.0 0.1 612024 7820 ? Ss May12 0:04 php-fpm: master process (/etc/php-fpm.conf) fpmport 4571 0.0 0.0 611620 5864 ? S May12 0:00 php-fpm: pool port fpmport 4572 0.0 0.0 611620 5892 ? S May12 0:00 php-fpm: pool port ...... 如果沒有運行,使用啟動: /etc/init.d/php-fpm start >>>php-fpm隊列滿了 php-fpm.conf (/etc/php-fpm.conf)配置文件pm.max_children修改大一點,重啟php-fpm并觀察日志情況 cd
也看到一個,端口被占用的情況:
nginx的error日志里經常報錯 2011/09/27 13:03:47 [error] 17493#0: *7438996 connect() failed (111: Connection refused) while connecting to upstream, client: 180.168.109.106, server: mysite.com, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "mysite.com" 2011/09/27 13:03:48 [error] 17493#0: *7438996 connect() failed (111: Connection refused) while connecting to upstream, client: 180.168.109.106, server: mysite.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "mysite.com" 2011/09/27 13:03:49 [error] 17493#0: *7438996 connect() failed (111: Connection refused) while connecting to upstream, client: 180.168.109.106, server: mysite.com, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "mysite.com" php-fpm的 ERROR級別的日志是, [27-Sep-2011 12:08:02] ERROR: bind() for address '127.0.0.1:9000' failed: Address already in use (98) [27-Sep-2011 12:30:04] ERROR: bind() for address '127.0.0.1:9000' failed: Address already in use (98) [27-Sep-2011 12:40:04] ERROR: bind() for address '127.0.0.1:9000' failed: Address already in use (98) [27-Sep-2011 12:50:04] ERROR: bind() for address '127.0.0.1:9000' failed: Address already in use (98) [27-Sep-2011 12:57:04] ERROR: bind() for address '127.0.0.1:9000' failed: Address already in use (98) [27-Sep-2011 13:03:04] ERROR: bind() for address '127.0.0.1:9000' failed: Address already in use (98) [27-Sep-2011 13:03:04] ERROR: bind() for address '127.0.0.1:9000' failed: Address already in use (98) 偶爾出現 [26-Sep-2011 17:48:24] ERROR: ptrace(PEEKDATA) failed: Input/output error (5) [26-Sep-2011 17:49:04] ERROR: bind() for address '127.0.0.1:9000' failed: Address already in use (98) [26-Sep-2011 17:49:32] ERROR: ptrace(PEEKDATA) failed: Input/output error (5) [26-Sep-2011 17:49:33] ERROR: ptrace(PEEKDATA) failed: Input/output error (5) [26-Sep-2011 17:49:42] ERROR: ptrace(PEEKDATA) failed: Input/output error (5)
原因:
ERROR: bind() for address '127.0.0.1:9000' failed: Address already in use (98)
很明顯9000端口被占用。
3個解決辦法
1 在nginx.conf中換個php的端口試試
2 實在不行還有sock方式。
3 殺死那個占用9000端口的程序。
2>
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。