title: How to put ownCloud behind Nginx with Docker?
body: <p>I want to access an ownCloud instance trough Nginx both set up inside separate Docker containers. So I've made <code>docker-compose.yml</code>:
  </p>
  
  <pre><code>nginx:
    image: nginx
    ports:
      - 80:80
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
    links:
      - owncloud
  owncloud:
    image: owncloud
    ports:
      - 6789:80
    volumes:
      - ~/ownCloud:/var/www/html/data
  </code></pre>
  
  <p>And <code>nginx.conf</code> to proxify requests with following contents:
  </p>
  
  <pre><code>http {
    server {
      listen 80 default;
      server_name docker.dev;
  
      location / {
        proxy_pass http://127.0.0.1:6789;
        proxy_buffering off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
      }
    }
  }
  events {}
  </code></pre>
  
  <p>Seems right to me, but Nginx logs out such message:</p>
  
  <p><code>[error] 6#6: *8 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.99.1, server: docker.dev</code></p>
  
  <p>What am I doing wrong?</p>