在centos7上安装好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项目文件夹放上去,却不能访问。采用127.0.0.1:9000和unix:/run/php-fpm.sock两种配置方式都不行,配置如下:
/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;
}
/etc/php-fpm.d/www.conf
#listen = /run/php-fpm.sock
listen = 127.0.0.1:9000
在nginx的错误日志/var/log/nginx/error.log中,两种配置出现的错误分别如下:
//使用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:"
//使用127.0.0.1:9000的时候错误:
connect() failed (111: Connection refused) while connecting to upstream, upstream: "fastcgi://127.0.0.1:9000"
哪里出了问题?
- 3 回答
- 0 关注
- 706 浏览
添加回答
举报
0/150
提交
取消