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'm trying to create a localhost server with nginx. I'm getting a 403 Forbidden on my page. Here's my nginx error log:

2013/03/30 20:39:18 [error] 12161#0: *1 directory index of "/home/mike/Projects/606club/" is forbidden, client: 127.0.0.1, server: localhost, request: "GET /606club/ HTTP/1.1", host: "localhost"

My nginx.conf file:

server {
    listen       80;
    server_name  localhost;

    #for .html sites
    location / {
        root   /home/mike/Projects;
        index  index.html index.htm;
    }

    #for .php sites
    location ~ \.php$ {
            root /home/mike/Projects;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            include /opt/nginx/conf/fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

My site at the URLs below gives me the following:

works

http://<myhost>/home/mike/Projects/thoth/index.html

403 Forbidden error

http://<myhost>/home/mike/Projects/606club/index.php

My folders have permissions 755.

share|improve this question
    
That URL didn't give you a 403 Forbidden error, according to your error message; a different URL did. –  Michael Hampton Mar 31 '13 at 3:45
add comment

3 Answers 3

Figured it out. Inside /etc/php5/fpm/pool.d/www.conf I had to change

listen = /var/run/php5-fpm.sock

to

listen = 127.0.0.1:9000
share|improve this answer
add comment

You need to add index.php to your index directive, if you want requests for / to be served by /index.php.

share|improve this answer
    
I added index.php and now I'm getting and an nginx error "An error occured.". In my error log same error. –  mikeglaz Mar 31 '13 at 18:36
add comment

try

sudo chmod 755 index.php

in my case this works, before this I cant see index.php but can index.html

share|improve this answer
add comment

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.