您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
问题描述:
服务器重启之后,服务器也正常运行,发现网站访问不了,后来查看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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。