php5-fpm出错

时间:2016-05-08 15:00:44

标签: 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中的服务器块

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;
#}

}

1 个答案:

答案 0 :(得分:3)

默认情况下,大多数发行版都配置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/