title: Directory index of "/var/www/html" is forbidden docker/nginx 403 error
body: <p>I think I've set up everything right in my nginx config which is built in docker-compose.yml. However, from tailing nginx logs it shows that</p>
  
  <pre><code>*1 directory index of "/var/www/html/" is forbidden
  </code></pre>
  
  <p>This results in a 403 forbidden page. I think I have set up permissions for www-data user properly, but maybe not.</p>
  
  <p>Directory structure:</p>
  
  <pre><code>  src/
      - docker-compose.yml
      - .gitignore
      backend
          src
          - Dockerfile
          - package.json
          - .gitignore
      data
          nginx
          - nginx.conf
      frontend
          src
          - Dockerfile
          - package.json
          - .gitignore
  </code></pre>
  
  <p>docker-compose:</p>
  
  <pre><code>#docker-compose.yml
  
  version: '3'
  
  services:
    frontend:
      build: ./frontend
      volumes:
        - ./data/nginx/:/etc/nginx/conf.d
      ports:
        - 8080:80
      depends_on:
        - backend
    backend:
      build: ./backend
      ports:
        - 3000:3000
      depends_on:
        - db
    db:
      image: postgres:latest
      restart: always
      environment:
        POSTGRES_USER: example
        POSTGRES_PASSWORD: example1234
        POSTGRES_DB: example
      ports:
        - 5432:5432
  </code></pre>
  
  <p>nginx.conf:</p>
  
  <pre><code>server {
      listen 80;
      server_name example;
  
      location / {
          root /var/www/html/;
          index index.html;
          autoindex on;
      }
  
      location /frontend {
          proxy_pass http://example:8080;
          try_files $uri /public/index.html;
      }
  
      location /backend {
          proxy_pass http://example:3000;
      }
  
      location /db {
          proxy_pass http://example:5432;
      }
  }
  </code></pre>
  
  <p>Any help is appreciated, thanks.</p>
  
  <p>Permissions updated:</p>
  
  <p>ls -l /var/www/</p>
  
  <pre><code>total 4
  drwxrwxr-x 6 root www-data 4096 Feb 15 15:44 html
  </code></pre>
  
  <p>ls -l /var/www/html/</p>
  
  <pre><code>total 200
  drwxrwxrwx 3 root www-data   4096 Feb 15 15:44 backend
  drwxrwxrwx 3 root www-data   4096 Feb 15 14:25 data
  -rw-rw-r-- 1 root www-data    736 Feb 15 15:44 docker-compose.yml
  drwxrwxrwx 6 root www-data   4096 Feb 15 15:44 frontend
  -rw-rw-r-- 1 root www-data 186352 Feb 15 15:44 package-lock.json
  </code></pre>
  
  <p>Update: fixed the 403 error by correctly directing to the index.html file inside /frontend/public/index.html. Still having errors with the app deploying to the server, though.</p>