Report this

What is the reason for this report?

403 Forbidden Error executing PHP scripts

Posted on February 16, 2015

Hello,

I have a problem. I’m not sure if this is a server related problem, but I’m sure missing something with the configuration. I receive 403 Forbidden errors for PHP scripts, however regular HTML files works fine. I’m using Nginx server and here is my configuration :

server { 
listen 80; 
server_name movieslike.co www.movieslike.co; 
root /var/www/movieslike.co/html; 
index index.php index.html index.htm;

location ~ \.php$ { 
try_files $uri =404; 
fastcgi_split_path_info ^(.+\.php)(/.+)$; 
fastcgi_pass unix:/var/run/php5-fpm.sock; 
fastcgi_index index.php; 
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
include fastcgi_params; 
} 
}

What am I missing here ? Is this a server related problem or is this something wrong with this config file ?

Thanks, Oguz

Edit :

I think I figured out the problem. When I go to http://movieslike.co it gives 403. When I go to http://movieslike.co/index.php then it works. Why doesn’t nginx see my index.php file ?

Thanks, Oguz



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This question was answered by @oguzgelal:

Hello

I restarted it and still the same thing. There is one line I have noticed like this:

*65 directory index of "/var/www/movieslike.co/html/" is forbidden

I have set the chmod of the directory to 755 though.

View the original comment

This comment has been deleted

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.