403 forbidden on nginx

mikeglaz asked:

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.

I answered:

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

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

Comments are closed.