我正在centos 7.3
部署一个php项目,错误connect() failed
。
nginx
和php
以及mariadb
一直在运行,我可以访问nginx的欢迎页面。
[root@demo ~]# systemctl list-unit-files --type=service | grep enabled
//...
mariadb.service enabled
mysql.service enabled
mysqld.service enabled
nginx.service enabled
php-fpm.service enabled
//...
然后,我将一个php项目上传到这个centos服务器。
nginx配置如下:/etc/nginx/conf.d/default.conf
location ~ \.php$ {
root /var/www/project/public;
#fastcgi_pass unix:/run/php-fpm.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
php配置如下:/etc/php-fpm.d/www.conf
#listen = /run/php-fpm.sock
listen = 127.0.0.1:9000
/var/log/nginx/error.log
中的错误:
//error of using `unix:/run/php-fpm.sock`:
connect() to unix:/run/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, upstream: "fastcgi://unix:/run/php-fpm.sock:"
//error of `using 127.0.0.1:9000`:
connect() failed (111: Connection refused) while connecting to upstream, upstream: "fastcgi://127.0.0.1:9000"
我该怎么办?