Created
August 10, 2012 06:09
-
-
Save jjt/3311654 to your computer and use it in GitHub Desktop.
nginx server block for static root + django proxy
This file contains 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 nginx; | |
worker_processes 1; | |
error_log /var/log/nginx/error.log warn; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | |
'$status $body_bytes_sent "$http_referer" ' | |
'"$http_user_agent" "$http_x_forwarded_for"'; | |
access_log /var/log/nginx/access.log main; | |
sendfile on; | |
tcp_nopush on; | |
server_names_hash_bucket_size 128; | |
keepalive_timeout 65; | |
#gzip on; | |
#include /etc/nginx/conf.d/*.conf; | |
include /etc/nginx/sites-enabled/*; | |
server { | |
listen 192.168.1.132:80 default; | |
server_name 192.168.1.132; | |
access_log /var/log/nginx/default.access.log; | |
error_log /var/log/nginx/default.error.log; | |
location / { | |
root /usr/share/nginx/html; | |
index index.html index.htm; | |
} | |
} | |
#include /etc/nginx/sites-enabled/mt.centos.local; | |
} |
This file contains 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
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_buffers 32 4k; |
This file contains 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
server { | |
listen 192.168.1.132:80; | |
server_name rmx.centos.local; | |
access_log /var/log/nginx/rmx.centos.local.access.log; | |
error_log /var/log/nginx/rmx.centos.local.error.log; | |
root /home/dev/sites/rmx/media/bbb-chrono/; | |
location /site_media { | |
root /home/dev/sites/rmx/; | |
expires 24h; | |
} | |
location / { | |
try_files $uri $uri/ @proxy; | |
} | |
location @proxy { | |
include /etc/nginx/proxy.conf; | |
proxy_pass http://127.0.0.1:8000; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment