Created
November 27, 2013 03:24
-
-
Save cryptojuice/7670226 to your computer and use it in GitHub Desktop.
Simple nginx configuration. proxy to gunicorn.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user nobody nogroup; | |
worker_processes 1; | |
pid /var/run/nginx.pid; | |
error_log /var/log/nginx/error.log; | |
events { | |
worker_connections 1024; | |
accept_mutex off; | |
} | |
http { | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
access_log /var/log/nginx/access.log; | |
sendfile off; | |
upstream app_server { | |
server 127.0.0.1:8000 fail_timeout=0; | |
# server unix:/tmp/gunicorn.sock fail_timeout=0; | |
} | |
server { | |
listen 80 default; | |
client_max_body_size 4G; | |
server_name app_server; | |
keepalive_timeout 5; | |
# path for static files | |
# root /vagrant/app/static; | |
location / { | |
root /vagrant/app/static; | |
try_files $uri /index.html; | |
} | |
location /api { | |
try_files $uri @proxy_to_app; | |
} | |
location @proxy_to_app { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_pass http://app_server; | |
} | |
error_page 500 502 503 504 /500.html; | |
location = /500.html { | |
root /vagrant/app/static; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment