php - Nginx config issue: getting 403 Forbidden -


i'm trying set web application using nginx, when trying access getting 403 error. i've followed various different approaches solving including making sure permissions set no avail.

here iss config web application:

server {     listen   80;     server_name         localhost      index               index.php index.html index.htm;     root                /usr/share/nginx/html/my-app/webapp;     port_in_redirect    off;      # use cached or actual file if exists, otherwise pass request wordpress     location / {         try_files $uri $uri/ /index.php?q=$uri&$args;     }      # deny access hidden files     location ~* /\.ht {         deny            all;         access_log      off;         log_not_found   off;     }      # pass php scripts on php-fpm     location ~* \.php$ {         try_files       $uri /index.php;         fastcgi_index   index.php;         fastcgi_pass unix:/var/run/php5-fpm.sock;         include         fastcgi_params;         fastcgi_param   script_filename    $document_root$fastcgi_script_name;         fastcgi_param   script_name        $fastcgi_script_name;     }  } 

i ran chmod -r 777 my-app give permissions.

yet still 403 error.

you missing ; on server_name directive, syntax error, in case translates to:

server_name localhost index index.php index.html index.htm; 

which may weird list of server names, more importantly, means not have index directive. means http 403 response code whenever attempt list directory such /.


Comments