centos8 yum custom installation of nginx, nginx default modify the default directory, point to a custom directory / data / www, 404 reported access all files as root user group permissions to 755 nginx to user as nginx
In theory there is no problem. Internet search, he said that the definition can not be put in the catalog / opt or / home or under / user / zhoulujun directory. Even if I move a directory to the directory directory / usr / share / nginx / html directory, or can not access my files
Torture going crazy. Micro letter the group asked the next, all that user group permissions do not, nginx configuration files wrong. As 7--8 years of grassroots owners, these configurations should not be bad either. Kazakhstan is not for the visit, Best not ride sister ah.
Sleep a night woke up, I was thinking, selinux,
setenforce 0
nginx -s reload
Sure enough, ok. He graduated dog, a waste of a night to 2:00 sleep.
These two days are broken ladder a few ip, Baidu bing search a bunch of problems, are a bunch of talk about rights, such as
the n- ginx File Access 403 issues https://www.cnblogs.com/liqipeng/p/9451760.html
Change the Nginx web root cause of the problem as well as 403 forbidden solve https://blog.csdn.net/lisongjia123/article/details/51260265
bing search to the international version, it is centos 5.x version of the problem, but this one,
https://stackoverflow.com/questions/6795350/nginx-403-forbidden-for-all-files
A reply:
sudo chcon -v -R --type=httpd_sys_content_t /path/to/www/
It is the solution
Now restored google visited, and soon found the answer
About CentOS under httpd 403 wrong answers (white scheme) modified the default directory https://blog.csdn.net/scshang/article/details/52437083
About centos nginx 403 forbidden access solution to the problem https://blog.csdn.net/weixin_45439324/article/details/102994785
This article summarizes well: Centos7 nginx error 403 forbidden https://www.cnblogs.com/zhaijiahui/p/8449429.html