1

Calling "http://test.local/" in the browser returns a "403 Forbidden" error. Calling "http://test.local/index.php" works well.

If I create a "index.html" file, calling "http://test.local/" shows me the "index.html" file correctly.

So just the "index.php" file doesn't work.

This is my vhost configuration:

server { listen 80; server_name test.local; root /var/www/public; index index.html index.htm index.php; location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } } 

The error.log file contains this error:

2013/12/28 14:00:57 [error] 2854#0: *50 directory index of "/var/www/public/" is forbidden, client: 10.0.2.2, server: test.local, request: "GET / HTTP/1.1", host: "test.local" 

Why's that? I've googled a lot now and checked permissions (which are all set to 777) and tried lots of other stuff too, but I don't get it working.

I'm new to nginx so probably I'm just missing something.

Thanks a lot!

1 Answer 1

1

Your configuration seems fine, but I think it can be simplified, try this

server { listen 80; server_name test.local; root /var/www/public; index index.php; location ~ \.php$ { include fastcgi_params; fastcgi_pass unix:/var/run/php5-fpm.sock; } } 
Sign up to request clarification or add additional context in comments.

2 Comments

did you try to reload nginx ?
I was able to get it running somehow - by completely reinstalling the virtual machine and now it works, although I think I didn't change anything relevant. Not sure what the reason was. If I find out I'll report back.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.