› NGINX
› NGINX Trac
› 3rd Party Modules
› Security Advisories
› CHANGES
› OpenResty
› ngx_lua
› Tengine
在线学习资源
› NGINX 开发从入门到精通
NGINX Modules
› ngx_echo
morethansean
V2EX  ›  NGINX

关于静态资源 403 的问题

  •  
  •   morethansean · Jan 10, 2017 · 3628 views
    This topic created in 3584 days ago, the information mentioned may be changed or developed.

    配了一个

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

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

    5 replies  •  2017-01-10 17:55:47 +08:00
    fangdingjun
    fangdingjun
    Jan 10, 2017
    1
    上层目录没权限
    chmod 0755 /root
    chmod 0755 /root/web
    chmod 0755 /root/test
    fangdingjun
    fangdingjun
    Jan 10, 2017
    2
    更正
    最后一个是
    chmod 0755 /root/web/test
    morethansean
    morethansean
    OP
    Jan 10, 2017 via Android
    3
    @fangdingjun 我已经 chmod 777 /root/web/test 了...也是不行...
    morethansean
    morethansean
    OP
    Jan 10, 2017 via Android
    4
    @fangdingjun 噢,他的上级目录也需要是吧...我试试...谢谢~
    lslqtz
    lslqtz
    Jan 10, 2017
    5
    chmod -R 。
    如果你这个目录下面还有目录, chmod 是没用的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1376 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 18:53 · PVG 02:53 · LAX 10:53 · JFK 13:53
    ♥ Do have faith in what you're doing.