当前位置:   article > 正文

nginx 权限问题_stat() permission

stat() permission

TP/1.1", host: "54.248.145.23"
2018/09/06 07:19:41 [crit] 8635#8635: *2 stat() "/home/thunderAI/release/index.html" failed (13: Permission denied), client: 103.90.76.205, server: 45smart.thundersoft.com, request: "GET / HTTP/1.1", host: "54.248.145.23"
2018/09/06 07:19:41 [crit] 8635#8635: *2 stat() "/home/thunderAI/release/index.html" failed (13: Permission denied), client: 103.90.76.205, server: 45smart.thundersoft.com, request: "GET / HTTP/1.1", host: "54.248.145.23"
2018/09/06 07:19:41 [crit] 8635#8635: *2 stat() "/home/thunderAI/release/index.html" failed (13: Permission denied), client: 103.90.76.205, server: 45smart.thundersoft.com, request: "GET / HTTP/1.1", host: "54.248.145.23"
2018/09/06 07:19:41 [crit] 8635#8635: *2 stat() "/home/thunderAI/release/index.html" failed (13: Permission denied), client: 103.90.76.205, server: 45smart.thundersoft.com, request: "GET / HTTP/1.1", host: "54.248.145.23"
2018/09/06 07:19:41 [crit] 8635#8635: *2 stat() "/home/thunderAI/release/index.html" failed (13: Permission denied), client: 103.90.76.205, server: 45smart.thundersoft.com, request: "GET / HTTP/1.1", host: "54.248.145.23"
2018/09/06 07:19:41 [crit] 8635#8635: *2 stat() "/home/thunderAI/release/index.html" failed (13: Permission denied), client: 103.90.76.205, server: 45smart.thundersoft.com, request: "GET / HTTP/1.1", host: "54.248.145.23"
2018/09/06 07:19:41 [crit] 8635#8635: *2 stat() "/home/thunderAI/release/index.html" failed (13: Permission denied), client: 103.90.76.205, server: 45smart.thundersoft.com, request: "GET / HTTP/1.1", host: "54.248.145.23"
2018/09/06 07:19:41 [crit] 8635#8635: *2 stat() "/home/thunderAI/release/index.html" failed (13: Permission denied), client: 103.90.76.205, server: 45smart.thundersoft.com, request: "GET / HTTP/1.1", host: "54.248.145.23"
2018/09/06 07:19:41 [error] 8635#8635: *2 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 103.90.76.205, server: 45smart.thundersoft.com, request: "GET / HTTP/1.1", host: "54.248.145.23"
 

 

 

134down voteaccepted

Nginx operates within the directory, so if you can't cd to that directory from the nginx user then it will fail (as does the stat command in your log). Make sure the www-user can cd all the way to the /username/test/static. You can confirm that the stat will fail or succeed by running

sudo -u www-data stat /username/test/static

In your case probably the /username directory is the issue here. Usually www-data does not have permissions to cd to other users home directories.

The best solution in that case would be to add www-data to username group:

gpasswd -a www-data username

and make sure that username group can enter all directories along the path:

chmod g+x /username && chmod g+x /username/test && chmod g+x /username/test/static

For your changes to work, restart nginx

nginx -s reload
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/秋刀鱼在做梦/article/detail/947659
推荐阅读
相关标签
  

闽ICP备14008679号