2

What I have checked so far:

Logs - they are empty, booted a new VM.

Permissions:

$ namei -l /var/www/awesome/    
f: /var/www/awesome/    
dr-xr-xr-x root     root     /    
drwxr-xr-x root     root     var    
drwxrwxr-x www-data www-data www
drwxrwxr-x www-data www-data awesome

Given 777 to the host OS folder that has the vagrant file.

Enabled SELinux.

Still, even inside the vm with curl localhost I get a 403.

Here is the nginx configuration for awesome.dev

server {
   listen                *:80;

   server_name           awesome.dev www.awesome.dev;
     index  index.html index.htm index.php;

   access_log            /var/log/nginx/awesome.dev.access.log;
   error_log             /var/log/nginx/awesome.dev.error.log;

   location / {
     root  /var/www/awesome;
     try_files $uri $uri/ index.php /index.php$is_args$args;
   }
   location ~ \.php$ {
     root  /var/www/awesome;
     index  index.html index.htm index.php;
     fastcgi_index index.php;
     fastcgi_param SCRIPT_FILENAME $request_filename;
     fastcgi_param APP_ENV dev;
     fastcgi_pass 127.0.0.1:9000;
     fastcgi_split_path_info ^(.+\.php)(/.*)$;
     include fastcgi_params;
   }
   sendfile off;
 }

How to fix this?

7
  • Is SELinux set to enforcing?
    – aairey
    Oct 30, 2014 at 12:13
  • @aairey SELinux is disabled. (sestatus) Oct 30, 2014 at 12:27
  • Enabled SELinux, still getting 403. Oct 30, 2014 at 13:24
  • Check your error log. Oct 30, 2014 at 16:07
  • @MichaelHampton nginx error and access logs are empty. Oct 30, 2014 at 17:15

2 Answers 2

3

Had the same issue with CentOS 7. Resolved by:

Check getenforce

This should show 'Enforcing'

Then I ran chcon to change the httpd security context to allow access.

chcon -Rt httpd_sys_content_t /path/to/web/content

Reload Nginx

systemctl restart nginx

Now my pages load.

0

What is the content of /var/www/awesome/ and its permissions?

If there is no index.html, index.htm or index.php file, nginx will be attempting to list directory content, which is by default forbidden (cf. autoindex documentation).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .