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.
Best Answer
You need to add
index.php
to yourindex
directive, if you want requests for/
to be served by/index.php
.