title: Php with Nginx - 403 Forbidden
body: <p>I want to run project yii2(advanced template) with nginx. I use virtualbox with vagrant(ubuntu 16.04, php 5.6).</p>
  <p>I have following settings in my Nginx file:</p>
  <pre><code>vhost1.conf
  server {
     listen                *:80;
   
     server_name  frontend.test;
     client_max_body_size 128m;
   
     root /var/www/frontend/web/;
       index index.php;
   
     access_log            /var/log/nginx/vhost1.access.log;
     error_log             /var/log/nginx/vhost1.error.log;
     location / {
       try_files $uri $uri/ /index.php$is_args$args;
     }
   
     location ~ ^/assets/.*\.php$ {
         deny all;
     }
   
     location ~ \.php$ {
       include fastcgi_params;
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
       fastcgi_pass 127.0.0.1:9000;
       #fastcgi_pass unix:/var/run/php5-fpm.sock;
       try_files $uri =404;
     }
   
     location ~* /\. {
       deny all;
     }
   }
  </code></pre>
  <p>I have following structure project with permission:</p>
  <pre><code>vagrant@machine1]-[/var/www]-[git master] 
  $ ls -la frontend/
  total 68
  drwxrwxr-x 1 vagrant vagrant 4096 Jul  5 14:27 ./
  drwxrwxr-x 1 vagrant vagrant 4096 Jul  9 16:14 ../
  drwxrwxr-x 1 vagrant vagrant 4096 Jul  5 14:27 assets/
  drwxrwxr-x 1 vagrant vagrant 4096 Jul  5 14:27 bootstrap/
  drwxrwxr-x 1 vagrant vagrant 4096 Jul  5 14:27 components/
  drwxrwxr-x 1 vagrant vagrant 4096 Jul  5 14:27 config/
  drwxrwxr-x 1 vagrant vagrant 4096 Jul  5 14:27 controllers/
  drwxrwxr-x 1 vagrant vagrant 4096 Jul  5 14:27 data/
  drwxrwxr-x 1 vagrant vagrant 4096 Jul  5 14:27 helpers/
  drwxrwxr-x 1 vagrant vagrant 4096 Jul  5 14:27 messages/
  drwxrwxr-x 1 vagrant vagrant 4096 Jul  5 14:27 models/
  drwxrwxr-x 1 vagrant vagrant 4096 Jul  5 14:27 modules/
  drwxrwxr-x 1 vagrant vagrant 4096 Jul  5 14:27 runtime/
  drwxrwxr-x 1 vagrant vagrant 4096 Jul  5 14:27 validators/
  drwxrwxr-x 1 vagrant vagrant 4096 Jul  5 14:27 views/
  drwxrwxr-x 1 vagrant vagrant 4096 Jul  5 14:27 web/
  drwxrwxr-x 1 vagrant vagrant 4096 Jul  5 14:27 widgets/
  </code></pre>
  <p>nginx error logs output:</p>
  <pre><code>2018/07/09 21:42:36 [error] 23865#23865: *1 directory index of &quot;/var/www/frontend/web/&quot; is forbidden, client: 192.168.56.1, server: b2bfrontend.test, request: &quot;GET / HTTP/1.1&quot;, host: &quot;b2bfrontend.test&quot;
  </code></pre>
  <p>If I run <strong>b2bfrontend.test</strong> I get an error - <strong>403 Forbidden</strong></p>