Installing nginx and gunicorn - mlevans/warhol GitHub Wiki

  1. brew install nginx

  2. Change the default port to 80: stop the server with sudo nginx -s stop and edit nginx.conf (found at /usr/local/etc/nginx/nginx.conf)

    You can also use this sample to get nginx and gunicorn set up:

    server {
         listen 80;
         server_name localhost;
         access_log  /var/log/nginx/example.log;
    
        location / {
            proxy_pass http://127.0.0.1:8000;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
      }
    
  3. pip install gunicorn (can do this with virtualenv as well)

  4. Start nginx again with sudo nginx

  5. Start gunicorn with gunicorn -w 4 app:app