nginx 1.8.1 only works with default root

codeninja214 asked:

I have Cent OS 6.6 with nginx 1.8.1 installed. It seems like if I change the root in the conf file to something other than the default ‘/usr/share/nginx’ it gives an error 403 Permission denied. I have even given 777 permission to the other folder and files and it still doesn’t work. I tried changing the user in nginx to ‘apache’, ‘nginx’ or’root’ and that doesn’t work either. I have disabled SELinux too. The folder I was trying to get it to work is ‘/var/www/’. Is there some enforcement in this version of nginx so it only works with ‘/usr/share/nginx’ root?

My answer:


Use an appropriate directory to store your web documents, so that you do not need to disable SELinux.

These directories are:

  • /var/www
  • /srv/www

And if you have problems, don’t grope around blindly; check the logs to find out the specific problem.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.