Systemctl startup nginx did not load the nginx.conf configuration file?

  html5, question

Fedora23, I put my project folder under my user directory, and there are some static files (css, pictures, etc.), which are provided by nginx as a server.
Nginx is installed directly from fedora source with dnf using the method provided in the nginx tutorial above fedora wiki. After installation, the user configured in nginx.conf is “nginx”. No matter how I change the permissions of my user directory, it is 403 forbidden in short, and the permission to view log display is insufficient.

After reading the online tutorial, I said that it is only necessary to use root user directly in the development. it makes sense to think about it. I changed the user in nginx.conf to root. after restarting the nginx service, I checked psaux | grepninx and found that it was root user, but it was still 403

Later, I directly used nginx -c /etc/nginx/nginx.conf to start, and everything was normal. There is no difference in using ps aux to view users, only master process has changed from /usr/sbin/nginx to nginx-c/etc/nginx/nginx.conf.

The current speculation is that the configuration items about users in nginx.conf were not loaded correctly when systemctl was started (including the way of service nginx start), but the configuration of server is normal …

I don’t know if anyone has the same problem as me.

It turned out that SElinux’s permission management was causing trouble. he did not allow nginx to access nginx.conf google nginx selinux can find a method directly on the nginx website, that is, use semanage plus httpd_t or something. google can do it specifically.