title: 403 error on PHP files with nginx, PHP-FPM and docker
body: <p>I use docker-compose with the following <code>docker-compose.yml</code>:</p>
  
  <pre><code>web_db:
     image: mariadb:latest
     restart: always
     volumes:
      - ./var/mysql:/var/lib/mysql
     environment:
      MYSQL_ROOT_PASSWORD: "1234"
  
  web_front:
    image: nginx
    restart: always
    ports:
      - 80:80
    links:
      - web_fpm
    volumes:
      - ./www:/var/www/html:rw
      - ./etc/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
  
  web_fpm:
    build: ./PHP-FPM/
    restart: always
    links:
      - web_db:mysql
    volumes:
      - ./www:/var/www/html
  </code></pre>
  
  <p>The nginx conf is:</p>
  
  <pre><code>worker_processes  1;
  
  
  events {
      worker_connections  1024;
  }
  
  http {
      include       mime.types;
  
      default_type  application/octet-stream;
  
      sendfile        on;
  
      keepalive_timeout  65;
  
      gzip on;
      gzip_disable "msie6";  
      gzip_vary on;
      gzip_proxied any;
      gzip_comp_level 6;
      gzip_buffers 16 8k;
      gzip_http_version 1.1;
      gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
  
      server {
        listen         80;
        server_name    localhost;
        root /var/www/html;
  
     location ~ [^/]\.php(/|$) {
          fastcgi_split_path_info ^(.+?\.php)(/.*)$;
          if (!-f $document_root$fastcgi_script_name) {
                  return 404;
          }
            root           /var/www/html;
            fastcgi_pass   web_fpm:9000;
            fastcgi_index  index.php;
            fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
            include        fastcgi_params;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
        }    
      }
  }
  </code></pre>
  
  <p>It work well if I create <code>index.html</code>. But if I want to access <code>index.php</code>, I have a 403 error and the following log in docker-compose:</p>
  
  <pre><code>web_front_1  | 2016/05/12 12:59:44 [error] 7#7: *1 directory index of "/var/www/html/" is forbidden, client: IP, server: localhost, request: "GET / HTTP/1.1", host: "IP"
  web_front_1  | IP - - [12/May/2016:12:59:44 +0000] "GET / HTTP/1.1" 403 197 "-" "Mozilla/5.0 (Linux; Android 6.0.1; A0001 Build/MMB29X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.105 Mobile Safari/537.36"
  </code></pre>
  
  <p>I've tried advices found in other Q&amp;A (like <a href="https://stackoverflow.com/questions/23390531/access-denied-403-for-php-files-with-nginx-php-fpm">here</a>), but I can't get it to work.</p>