Nginx解析静态文件在CentOS 7下遭遇403错误

懒得翻译了,反正按中文互联网上的什么改权限这的那的不管用折腾了好久,下面这段话save my ass.

I experienced the same problem and it was due to SELinux.

To check if SELinux is running:

# getenforce

To disable SELinux until next reboot:

# setenforce Permissive

Restart Nginx and see if the problem persists. If you would like to permanently alter the settings you can edit /etc/sysconfig/selinux

If SELinux is your problem you can run the following to allow nginx to serve your www directory (make sure you turn SELinux back on before testing this. i.e, # setenforce Enforcing)

# chcon -Rt httpd_sys_content_t /path/to/www

If you're still having issues take a look at the boolean flags in getsebool -a, in particular you may need to turn on httpd_can_network_connect for network access

# setsebool -P httpd_can_network_connect on

For me it was enough to allow http to serve my www directory.

原地址:https://stackoverflow.com/questions/22586166/why-does-nginx-return-a-403-even-though-all-permissions-are-set-properly

关于SELinux这东东,可以看下这个链接:https://cnzhx.net/blog/turn-off-selinux/

For example, "name@something.com". If someone replies to you it will be via email.
For example, "http://someaddress.com"