php - php5-fpm 错误

标签 php nginx

当我在尝试查看我的网站之一时遇到 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/

相关文章:

javascript - 如何将javascript返回的值从 View 传递到laravel中的 Controller

c++ - wurfl nginx 构建错误

php - Laravel 5.4 - 如何覆盖包中定义的路由?

php - 数组reduce在函数外部分配变量

php - php中PDO查询语句期间如何转义?

php - 维护网站的事件 FB 身份验证 session

json - 如何从 nginx 生成 JSON 日志?

http - 用于 uWSGI 服务器的 worker 和线程的标准数量是多少?

networking - 为什么 nginx 在加载资源时会从平均服务器返回 404?

reactjs - 使用Nginx部署React加载资源失败