Question

403 Forbidden nginx/1.6.3 (centos 7)

After i installed nginx/1.6.3 & php56w-fpm, i run my website in the browser with a VH listening for port 80 and it worked, but at the moment I wanted to create a VH that listens for port 443 to access via https and that’s when I get error 403 Forbidden, when I go to the error log what it shows me is *1 directory index of “/var/www/PROJECT/web/” is forbidden. I set 777 to www folder and i change the owner to nginx:nginx and the same error still comes out. The configuration of my VH is as follows

server { listen 443 ssl spdy; server_name project.lh; root /var/www/PROJECT/web;

server_tokens off;

ssl on;
ssl_certificate /etc/nginx/ssl/cert.crt;
ssl_certificate_key  /etc/nginx/ssl/cert.key;

ssl_session_timeout  5m;
ssl_session_cache shared:SSL:20m;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers  HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers   on;

location / {
    try_files $uri $uri/ /app.php$is_args$args;
}
# PROD
location ~ ^/app\.php(/|$) {
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
    fastcgi_param DOCUMENT_ROOT $realpath_root;
    internal;
}

location  ~ /\.ht {
    deny  all;
}

location ~ \.php$ {
  return 404;
}

error_log /var/log/nginx/project-ssl_error.log;
access_log /var/log/nginx/project-ssl_access.log;

}

My site is made in symfony 2.8. Could you please help me to explain how should i check? Thanks


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

This comment has been deleted

Add an index config inside the server {...} block preferably bellow root:

server {
    listen 443 ssl spdy;
    server_name project.lh;
    root /var/www/PROJECT/web;
    index index.php index.html index.htm;
[...]
}

Do a config test and reload Nginx:

sudo service nginx configtest && sudo service nginx reload