找不到nginx + php5-fpm.sock

时间:2016-05-24 09:46:28

标签: php sockets nginx

我有几个子域,每个子域都有一个套接字:

在/etc/php5/fpm/pool.d/album.conf ::

user = album
group = album
listen = /var/run/php5-fpm-album.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
php_admin_value[disable_functions] = exec,passthru,shell_exec,system
php_admin_flag[allow_url_fopen] = off
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chdir = /

在/etc/php5/fpm/pool.d/www.conf ::

user = www-data
group = www-data
listen = /var/run/php5-fpm.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0660

在/etc/nginx/nginx.conf ::

upstream php5-fpm-album-sock {
    server unix:/var/run/php5-fpm-album.sock;
}

server {
            ## Escucha en el puerto 80 (HTTP)
            listen 80;

            ## Raíz donde se encuentra la página Web
            root /srv/www/album/;

            ## Orden de prioridad de los archivos index
            index index.php index.html index.htm;

            server_name album.bichomen.com;
            access_log /srv/www/album/access.log;

                location ~ \.php$ {
                   root /srv/www/album;
                   try_files $uri =404;
                   fastcgi_split_path_info ^(.+\.php)(/.+)$;
                   fastcgi_pass php5-fpm-album-sock;
                   fastcgi_index index.php;
                   fastcgi_param SCRIPT_FILENAME 
                   $document_root$fastcgi_script_name;
                   include fastcgi_params;
            }
    }

问题是不相信 / var / run /

中的套接字

nginx.log中的错误:

1 connect() to unix:/var/run/php5-fpm-album.sock failed 
(2: No such file or directory)

问题出在哪里?谢谢。

3 个答案:

答案 0 :(得分:0)

ls -lah / var / run

lrwxrwxrwx 1 root root 4 Feb 28  2015 /var/run -> /run

我创建了目录php5-fpm:

drwxrwxr-x  2 www-data www-data 40 May 24 14:52 php5-fpm

我修改了配置文件:

unix server: /var/run/php5-fpm/album.sock;

答案 1 :(得分:0)

最后重新启动服务器并运行。

答案 2 :(得分:-1)

  1. 将php5-fpm.sock更改为php-fpm.sock
  2. 重启php-fpm服务
  3. 重启nginx服务