V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
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 · 3400 views
    This topic created in 3400 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
        1
    fangdingjun  
       Jan 10, 2017
    上层目录没权限
    chmod 0755 /root
    chmod 0755 /root/web
    chmod 0755 /root/test
    fangdingjun
        2
    fangdingjun  
       Jan 10, 2017
    更正
    最后一个是
    chmod 0755 /root/web/test
    morethansean
        3
    morethansean  
    OP
       Jan 10, 2017 via Android
    @fangdingjun 我已经 chmod 777 /root/web/test 了...也是不行...
    morethansean
        4
    morethansean  
    OP
       Jan 10, 2017 via Android
    @fangdingjun 噢,他的上级目录也需要是吧...我试试...谢谢~
    lslqtz
        5
    lslqtz  
       Jan 10, 2017
    chmod -R 。
    如果你这个目录下面还有目录, chmod 是没用的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2511 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 06:37 · PVG 14:37 · LAX 23:37 · JFK 02:37
    ♥ Do have faith in what you're doing.