marcusshepp
3/16/2016 - 4:21 PM

Basic Nginx Script Listen's for a Gunicorn Generated Sock File

Basic Nginx Script Listen's for a Gunicorn Generated Sock File

upstream app_server {
  server unix:/opt/proc/mysite-gunicorn.sock fail_timeout=0;
}

server {

  listen 80;

  access_log /var/log/nginx/access.log;
  error_log /var/log/nginx/error.log;

  location / {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $server_name;
    proxy_redirect off;
    proxy_pass http://app_server;
    break;
  }

  location /media {
    alias /opt/media;
  }

  location /static {
    alias /opt/static;
  }
}