Mr A
Mr A

Reputation: 1385

Nginx: 403 Error on Server Block

I'm trying to make a simple server block on Nginx.

http://prntscr.com/90ccoy

One the bottom part on the image link is a simple configuration. When I type the address in the browser it should fetch the index.html in the folder, instead I get a 403 error.

I set the user to nginx:apache in my /var/www folder chown -R nginx:apache /var/www and still get a 403 error.

http://prntscr.com/90cez6

Upvotes: 0

Views: 407

Answers (1)

FiveYellowMice
FiveYellowMice

Reputation: 56

First, make sure user nginx has read access to the directory.

And if you use SELinux, it may be preventing nginx from serving the web pages. To fix this, change the SELinux context of the directory to httpd_sys_content_t, and turn on httpd_can_network_connect. For example:

chcon -Rt httpd_sys_content_t /var/www
setsebool -P httpd_can_network_connect 1

Upvotes: 1

Related Questions