Skip to content

Instantly share code, notes, and snippets.

@andreagrandi
Created August 6, 2013 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreagrandi/6163224 to your computer and use it in GitHub Desktop.
Save andreagrandi/6163224 to your computer and use it in GitHub Desktop.
This nginx rule redirects all the traffic that arrive on port 80 of the web server to the internal port 8000 (for example where a Django application is running).
server {
listen 80;
server_name mywebsite.com;
access_log /var/log/www/mywebsite.com/log/nginx.access.log;
error_log /var/log/www/mywebsite.com/log/nginx_error.log debug;
#set your default location
location / {
proxy_pass http://127.0.0.1:8000/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 16k;
proxy_buffers 32 16k;
proxy_busy_buffers_size 64k;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment