关于静态资源 403 的问题

2017-01-10 11:28:24 +08:00
 morethansean

配了一个

location /test/ { alias /root/web/test/; }

这样的设置,但是访问的时候始终是 403. 已经 chown 把 /root/web/test/ 改成了 nginx 的运行用户,还是 403. 试了一下,把 nginx 作为 root 用户运行是可以的,改回用户 nginx 就又 403 了。网上搜了一下都是教你把 static 的目录改成 nginx 的运行用户,可是还是 403 啊有没有小伙伴能讲解一下……

2963 次点击
所在节点    NGINX
5 条回复
fangdingjun
2017-01-10 12:03:41 +08:00
上层目录没权限
chmod 0755 /root
chmod 0755 /root/web
chmod 0755 /root/test
fangdingjun
2017-01-10 12:04:51 +08:00
更正
最后一个是
chmod 0755 /root/web/test
morethansean
2017-01-10 12:08:12 +08:00
@fangdingjun 我已经 chmod 777 /root/web/test 了...也是不行...
morethansean
2017-01-10 12:09:10 +08:00
@fangdingjun 噢,他的上级目录也需要是吧...我试试...谢谢~
lslqtz
2017-01-10 17:55:47 +08:00
chmod -R 。
如果你这个目录下面还有目录, chmod 是没用的

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/333547

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX