当我在尝试查看我的网站之一时遇到 403 错误时,我刚刚安装了 nginx 和 php-fpm。当我检查 nginx 错误日志时,我看到了一些诸如权限被拒绝之类的内容,但我也注意到了这一点:
/var/run/php5-fpm.sock failed (2: no such file or directory)
但是我安装了 php-fpm,为什么它会加载 php5-fpm?我很困惑,有什么想法吗?
谢谢。
编辑:default.conf 中的服务器 block
server {
listen 81 default_server;
server_name _;
#charset koi8-r;
#access_log logs/host.access.log main;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
最佳答案
默认情况下,大多数发行版将 php-fpm 配置为监听端口 9000 上的 TCP 套接字。
确保您的 fpm 实际上已配置为监听文件套接字
listen =/var/run/php5-fpm.sock
或者将 nginx 配置为 fcgi_pass 127.0.0.1:9000
这是完整的指南
https://support.rackspace.com/how-to/installing-nginx-and-php-fpm-setup-for-php-fpm/
关于php - php5-fpm 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37101218/