我试图用nginx创build一个localhost服务器。 我在我的页面上收到了一个403 Forbidden 。 这是我的nginx错误日志:
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"
我的nginx.conf文件:
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; } }
我的网站在下面的URL给我以下内容:
作品
http://<myhost>/home/mike/Projects/thoth/index.html
403禁止的错误
http://<myhost>/home/mike/Projects/606club/index.php
我的文件夹有权限755。
如果你想要/由/index.php服务的请求,你需要添加index.php到你的index指令。
弄清楚了。 在/etc/php5/fpm/pool.d/www.conf里面我不得不改变
listen = /var/run/php5-fpm.sock
至
listen = 127.0.0.1:9000
尝试
sudo chmod 755 index.php
在我的情况下,这个工程,在此之前,我不能看到index.php,但可以index.html