Created
July 18, 2012 15:30
-
-
Save hassek/3136943 to your computer and use it in GitHub Desktop.
nginx configuration
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 nobody; | |
worker_processes 1; | |
error_log /var/log/nginx/error.log; | |
#access_log /var/log/nginx/access.log; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 300; | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
#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; | |
sendfile on; | |
#tcp_nopush on; | |
keepalive_timeout 0; | |
# allows for on-the-fly gzip compression. | |
gzip on; | |
gzip_buffers 64 8k; | |
gzip_comp_level 1; | |
gzip_http_version 1.0; | |
gzip_min_length 1100; | |
gzip_types | |
application/javascript | |
application/x-javascript # added | |
application/json | |
application/rss+xml | |
application/vnd.ms-fontobject | |
application/xml | |
font/opentype | |
font/truetype | |
image/svg+xml | |
text/css | |
text/javascript | |
text/plain | |
text/x-component | |
text/xml; | |
gzip_vary on; | |
gzip_disable "MSIE [1-6].(?!.*SV1)"; | |
gzip_proxied expired no-cache no-store private auth; | |
server { | |
listen 8082; | |
root /PROJECT/static-content; | |
server_name hassek.local; | |
if ($http_user_agent ~* '(iPhone|iPod|iPad|Android|BlackBerry)') { | |
set $iphone_request '1'; | |
} | |
if ($http_cookie ~ 'iphone_mode=full') { | |
set $iphone_request ''; | |
} | |
if ($request_uri ~ '(/m/|/accounts/forgot/|/social.+|/static.+|/login.+|/complete.+|/close_window/)') { | |
set $iphone_request ''; | |
} | |
location /static { | |
add_header Cache-Control "public, max-age=31536000"; | |
alias /PROJECT/PATH/_generated_media/; | |
} | |
location /media { | |
add_header Cache-Control "public, max-age=31536000"; | |
alias /PROJECT/PATH/static_content/; | |
} | |
location ~ ^/(favicon.ico|robots.txt|sitemap.xml)$ { | |
add_header Cache-Control "public, max-age=31536000"; | |
alias /PROJECT/PATH/static_content/$1; | |
} | |
location / { | |
proxy_pass http://hassek.local:8080; | |
include /usr/local/etc/nginx/proxy.conf; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment