更改完nginx.conf配置文件中以下root配置之后,发现html网页访问会出现403 Forbidden。

location / { root html; index index.html index.htm index.php ; } location ~ .php$ { root html; fastcgi\_pass 127.0.0.1:9000; fastcgi\_index index.php; #fastcgi\_param SCRIPT\_FILENAME /scripts$fastcgi\_script\_name; fastcgi\_param SCRIPT\_FILENAME $document\_root$fastcgi\_script\_name; include fastcgi\_params; }

通过在nginx的logs目录下,使用tail -f * 查看错误信息,发现

[error] 993#0: *26 open() “/Users/navins/Documents/workspace/webapps/tt.html” failed (13: Permission denied), client: 127.0.0.1, server: localhost, request: “GET /tt.html HTTP/1.1”, host: “localhost”

很显然,是由于权限问题造成,所以需要更改目录的权限,使用chmod命令。

chmod o+rx /Users/navins/Documents/workspace/webapps

只添加这一级目录的权限还不够,需要将前面每一层的rx权限加上。

然后,再次访问该网页,没有403 Forbidden了吧。。