Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've got nginx 0.7x + PHP-FPM running under PHP 5.2.10 on one RHEL5 server, but trying to duplicate that setup under the bundled-in PHP-FPM in PHP 5.3.3 on a second server, I'm having some trouble with permission errors every time there's a GET.

FPM is started, and confirmed that fastcgi is listening on 9000, but each time I do a GET, I see this error in the nginx log:

2010/08/12 23:38:53 [crit] 5019#0: *5 stat() "/home/noisepages/www/" failed (13: Permission denied), client: 24.215.173.141, server: dev.noisepages.com, request: "GET / HTTP/1.1", host: "dev.noisepages.com"

Barebones nginx.conf.default works, at least. Here's my nginx.conf

server {
        listen       80;
        server_name  dev.noisepages.com;
        root   /home/noisepages/www;
        index  index.html index.htm index.php;

        access_log  logs/dev.access.log;
 error_log logs/dev.error.log;

        location / {

 if (-f $request_filename) {
  expires 30d;
  break;
  }

 # this sends all non-existing file or directory requests to index.php
 rewrite ^.*/files/(.*) /wp-includes/ms-files.php?file=$1;
 if (!-e $request_filename) {
     rewrite ^.+?(/wp-.*) $1 last;
  rewrite ^.+?(/.*\.php)$ $1 last;
  rewrite ^ /index.php last;
  }
        }

        location ~ \.php$ {
            include        fastcgi_params;
            fastcgi_pass   unix:/dev/shm/php-fastcgi.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME    /home/dev/www/$fastcgi_script_name;
        }
    }

(The extra rewrite directives are for the use of WordPress multisite aka WordPress MU)

I've also verified that user www-data is declared not only in nginx.conf but also in php-fpm.conf for user and group values.

Maybe I'm not understanding what causes the error 13 message? Oddly enough, I'd tried to set up dev.noisepages.com on the first server in parallel to a couple of other virtual hosts -- each of which was working fine - and got the same error.

share|improve this question

4 Answers 4

up vote 18 down vote accepted

You need to ensure you have +x on all of the directories in the path leading to the site's root - so /home, /home/noisepages and /home/noisepages/www

share|improve this answer
1  
Yes, in fact www had the correct permissions but not the whole path! Thanks! Makes sense - dumb mistake on my part. –  Peter Kirn Aug 13 '10 at 22:53
    
If I could give you another 10 upvotes I would. –  Tim Mar 7 '12 at 23:01

make sure /home/dev has correct permissions

chmod +x /home/dev
share|improve this answer

I had issues with permissions in php-fpm as well, in particular with php sessions. It turned out I just had to modify the user that php-fpm uses to run processes, since by default it was set to "nobody" user.

tutorial on it here: http://www.duchnik.com/tutorials/setting-up-php-with-nginx/

share|improve this answer
1  
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  Scott Pack Nov 18 '12 at 5:03

I had a simlar problem which got me here. My solution (based on the picked answer) was do a

chown -R root:www-data /home/noisepages/www
chmod g+w -R /home/noisepages/www

Now it works fine :)

share|improve this answer
    
But how can you do it if you use Chroot users ? When using chrooted users, the /home/user/www folder must be owned by the user, and it not works. –  Vincent LITUR Feb 7 at 9:41
    
Sorry, I don't know :( –  Scott Warren Feb 7 at 11:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.