如果本文對你有用,請愛心點個贊,提高排名,幫助更多的人。謝謝大家!❤
如果解決不了,可以在文末進羣交流。
查看nginx錯誤日誌,信息如下:
[root@VM_16_17_centos ~]# tail -f /data/logs/nginx_error.log 2019/11/02 23:42:16 [error] 11700#0: *34 connect() failed (111: Connection refused) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: www.mengyilingjian-eric.top, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "mysql.mengyilingjian-eric.top" 2019/11/02 23:42:17 [error] 11700#0: *34 connect() failed (111: Connection refused) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: mysql.mengyilingjian-eric.top, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "mysql.mengyilingjian-eric.top", referrer: "http://www.mengyilingjian-eric.top/"
解決辦法:
執行命令,查看9000端口是否監聽。
[root@VM_16_17_centos run]# netstat -anp|grep 9000
如果沒有監聽,則隨後查看PHP配置文件
[root@VM_16_17_centos ~]# vim /usr/local/php/etc/php-fpm.conf [global] pid = /usr/local/php/var/run/php-fpm.pid error_log = /usr/local/php/var/log/php-fpm.log log_level = notice [www] listen = 127.0.0.1:9000 listen.backlog = -1 listen.allowed_clients = 127.0.0.1 listen.owner = www listen.group = www listen.mode = 0666 user = www group = www pm = dynamic pm.max_children = 20 pm.start_servers = 10 pm.min_spare_servers = 10 pm.max_spare_servers = 20 pm.max_requests = 1024 pm.process_idle_timeout = 10s request_terminate_timeout = 100 request_slowlog_timeout = 0 slowlog = var/log/slow.log
此時修改nginx.conf 文件如下,需要php-fpm.conf中listen 的值與nginx.conf中fastcgi_pass值保持一直。
location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param APPLICATION_ENV production; include fastcgi_params; }
不懂地方可留言,或者進微信羣內交流。
羣二維碼:
羣二維碼如果過期,請加我個人微信:mengyilingjian.