title: Flask, Gunicorn, NGINX, Docker : What is properly the way to config SERVER_NAME and proxy_pass?
body: <p>I setup docker project using <strong>Flask</strong>, <strong>gunicorn</strong>, <strong>NGINX</strong> and <strong>Docker</strong>, which works fine if I didn't add <strong>SERVER_NAME</strong> in Flask's setting.py.</p>
  
  <p>The current config is :</p>
  
  <p><strong>gunicorn</strong></p>
  
  <pre><code>gunicorn -b 0.0.0.0:5000
  </code></pre>
  
  <p><strong>docker-compose.yml</strong></p>
  
  <pre><code>services:
    application:
      #restart: always
      build: .    
      expose:
       - "5000"
      ports:
       - "5000:5000"
      volumes:
       - .:/code
      links:
       - db
    nginx:
      restart: always
      build: ./nginx
      links:
        - application
      expose:
        - 8080
      ports:
        - "8880:8080"
  </code></pre>
  
  <p><strong>NGINX .conf</strong></p>
  
  <pre><code>server {
  
      listen 8080;
      server_name application;
      charset utf-8;
  
      location / {
          proxy_pass http://application:5000;
          proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      }
  }
  </code></pre>
  
  <p>Then I set the <strong>SERVER_NAME</strong> in Flask's setting.py</p>
  
  <pre><code>SERVER_NAME = '0.0.0.0:5000'
  </code></pre>
  
  <p>When I enter url <strong>0.0.0.0:8880</strong> to my browser, I get response 404 from nginx. What should be properly <strong>SERVER_NAME</strong> in Flask's setting.py ?</p>
  
  <p>Thanks in advance.</p>