1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

403 Forbidden nginx/1.6.3 (centos 7)

Discussion in 'Nginx' started by Allastair, Nov 21, 2016.

  1. #2
    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
     
    Allastair, Nov 21, 2016 IP
  2. RoseHosting

    RoseHosting Well-Known Member

    Messages:
    230
    Likes Received:
    11
    Best Answers:
    11
    Trophy Points:
    138
    #3
    Do you have index.php or index.html file in the '/var/www/PROJECT/web/' directory?

    You should add the following directive in your configuration:
    index index.htm index.html index.php;
    Code (markup):
     
    RoseHosting, Feb 26, 2017 IP
  3. nsb2006

    nsb2006 Active Member

    Messages:
    12
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    53
    #5
    There should be default index file, such as index.php or index.html etc, if you're using a index file different than usual, you need to specify the default index file in confirguration like @RoseHosting said.
     
    nsb2006, Apr 10, 2017 IP