title: run nginx in docker with another application
body: <p>I have my application that needs to serve on port <code>:5000</code></p>
  
  <p>Here's my dockerfile</p>
  
  <pre><code>FROM ubuntu:14.04
  RUN apt-get update
  RUN apt-get install -y nginx
  ADD ./nginx.conf /etc/nginx/sites-available/default
  RUN service nginx restart
  
  RUN go get github.com/a/mycmd
  
  EXPOSE 5000
  </code></pre>
  
  <p>And I run</p>
  
  <pre><code>sudo docker run --publish 5000:5000 --rm app /go/bin/mycmd
  </code></pre>
  
  <p>And here's my nginx config file:</p>
  
  <pre><code>limit_req_zone $binary_remote_addr zone=limit:10m rate=2r/s;
  
  server {
      listen 80;
  
      set_real_ip_from 0.0.0.0/0;
      real_ip_header X-Forwarded-For;
      real_ip_recursive on;
      server_name 123.13.13.13 example.com;
  
      location / {
          proxy_read_timeout 3000s;
          proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $remote_addr;
          proxy_pass http://127.0.0.1:5000;
          limit_req zone=limit burst=5 nodelay;
      }
  }
  </code></pre>
  
  <p>Then I expect this to redirect traffic from the webserver (port <code>80</code>) to my app port <code>5000</code>, but seems like <code>nginx</code> doesn't do the reverse proxy correctly. Traffic do not get directed to my app.</p>
  
  <p>How do I set up nginx and my app in the same container so that I can use it as a reverse proxy?</p>
  
  <p>Thanks!</p>