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:, 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_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:



403 Forbidden error


My folders have permissions 755.

  • 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

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

  • 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

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

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


listen =


sudo chmod 755 index.php

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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