Question

I've been searching the Google for the last day or so and tried several solutions. I don't know what could be causing this error. The following may be long, I apologize -- I'm trying to anticipate some common responses to try to help diagnosis the problem :)

2014/05/11 17:26:00 [crit] 29833#0: *31 connect() to unix:/var/run/php/default.sock failed (13: Permission denied) 

-

My vhost config is:

server {
        server_name             .lone0001.ca;
        listen                  80;

        root            /home/lone0001/public_html;
        error_log       /home/lone0001/.nginx/logs/error.log;
        access_log      /home/lone0001/.nginx/logs/access.log;

        include         /etc/nginx/includes/global/robots.conf;
        include         /etc/nginx/includes/global/wordpress.conf;
        include         /etc/nginx/includes/lone0001_php.conf;
}

The PHP configuration (an include) is thus:

location ~ \.php$ {
        try_files               $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        include                 /etc/nginx/includes/global/fastcgi_params;

        fastcgi_index           index.php;
        fastcgi_param           SCRIPT_FILENAME         $document_root$fastcgi_script_name;

        fastcgi_pass    unix:/var/run/php/lone0001.sock;
}

Now, my php fpm pool configuration has the following (abbreviated):

"lone0001.conf":

[lone0001]
user = lone0001
group = lone0001

listen = /var/run/php/lone0001.sock

listen.owner = lone0001
listen.group = lone0001
listen.mode = 0666

"www.conf":

[www]
user = www-data
group = www-data
listen = /var/run/php/default.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0666

File permissions you may ask?

superuser@myserver:/etc/php5/fpm/pool.d# ls -l /var/run/php/
total 0
srwxrwxr-- 1 www-data    www-data    0 May 11 17:21 default.sock
srwxrwxr-- 1 lone0001    lone0001    0 May 11 17:21 lone0001.sock

Some notes:

I have tried chmod -Rf 0666 /var/run/php and I've tried moving the PHP sockets to /tmp (no success). I also tried switching my vhost to my "default" PHP socket to no avail.

Was it helpful?

Solution

I bet this trouble appeared in your last update on your server.

I tried all what you have tried and the solution was to put user www-data; in the /etc/nginx/nginx.conf file.

user www-data;

events {
.....
.....
}

http {
.....
.....
}

Then restart your machine and hope that solve your problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top