title: nginx error 403 - directory index is forbidden
body: <p>I am trying to connect <code>docker nginx</code> with <code>docker flask</code>. Here is the structure of my project:</p>
  
  <pre><code>.
  ├── storage
  │   ├── nginx
  │   │   └── static
  │   │       └── image.gif
  └── web
      └── flask
          ├── app
          │   ├── run.py
          │   └── templates
          │       └── index.html
          ├── conf
          │   ├── nginx-default.conf
          │   ├── nginx-flask.conf
          │   └── requirements.txt
          └── Dockerfile
  </code></pre>
  
  <p>Although <code>curl 127.0.0.1:50</code> and <code>curl 127.0.0.1:80/static/image.gif</code> work fine, I get a '403 Forbidden' error when I do <code>curl 127.0.0.1</code>. More specifically, <code>nginx</code> gives the following error:</p>
  
  <pre><code>2016/03/05 17:54:37 [error] 8#8: *1 directory index of "/usr/share/nginx/html/" is forbidden, client: 172.17.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"
  172.17.0.1 - - [05/Mar/2016:17:54:37 +0000] "GET / HTTP/1.1" 403 169 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:44.0) Gecko/20100101 Firefox/44.0" "-"
  </code></pre>
  
  <p>I create the containers like this:</p>
  
  <pre><code>docker create \
  -v $ROOT/web/flask/app/:/web/flask/app/ \
  --name flask_data flask:0.1
  
  docker run \
  -d -p 127.0.0.1:50:50 \
  --volumes-from flask_data \
  --name flask_service flask:0.1
  
  docker create \
  -v $ROOT/storage/nginx/:/usr/share/nginx/html/ \
  --name nginx_data nginx:1.9
  
  docker run \
  -v $ROOT/web/flask/conf/nginx-flask.conf:/etc/nginx/conf.d/nginx-flask.conf \
  -v $ROOT/web/flask/conf/nginx-default.conf:/etc/nginx/conf.d/default \
  -d -p 127.0.0.1:80:80 \
  --volumes-from nginx_data \
  --link flask_service:flask_service_alias \
  --name nginx_service nginx:1.9
  </code></pre>
  
  <p>where, <code>Dockerfile</code> is:</p>
  
  <pre><code>FROM ubuntu:14.04
  
  RUN apt-get update &amp;&amp; apt-get install -y --no-install-recommends python-pip python-dev
  
  COPY . /web/flask/
  
  RUN pip install -r /web/flask/conf/requirements.txt
  
  CMD gunicorn run:app --workers=4 --bind=0.0.0.0:50 --log-level=debug --timeout=43200 --chdir=/web/flask/app/
  </code></pre>
  
  <p>and <code>requirements.txt</code> is:</p>
  
  <pre><code>gunicorn==19.4.5
  Flask==0.10.1
  Flask-Redis==0.1.0
  Flask-SQLAlchemy==2.1
  Flask-MongoAlchemy==0.7.2
  </code></pre>
  
  <p><code>nginx-default</code> is empty, and <code>nginx-flask</code> is:</p>
  
  <pre><code>server {
  
      listen          80;
      charset         utf-8;
  
      location /avatar {
          alias /usr/share/nginx/html/avatar;
      }
  
      location /scan {
          alias /usr/share/nginx/html/scan;
      }
  
      location /static {
          alias /usr/share/nginx/html/static;
      }
  
      location / {
          proxy_pass http://flask_service_alias:50/;
          proxy_set_header Host $host;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      }
  
  }
  </code></pre>
  
  <p>any ideas?</p>