Created
June 14, 2011 02:34
-
-
Save PatrickTulskie/1024202 to your computer and use it in GitHub Desktop.
nginx/unicorn conf from: http://mattdidcoe.com/discusses/scaling-a-rails-application-part-1
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
upstream unicorn { | |
server unix:/var/www/example/current/tmp/sockets/unicorn.sock; | |
} | |
server { | |
listen 80; | |
server_name example.org www.example.org; | |
access_log /var/log/nginx/example.access.log; | |
location / { | |
root /var/www/example/current/public/; | |
if (-f $request_filename) { | |
expires 60h; | |
break; # Static asset | |
} if (-f $document_root/system/maintenance.html) { | |
return 503; # Temporarily unavailable | |
} if (!-f $document_root/system/maintenance.html) { | |
# error_page 500 501 502 503 504 /500.html; | |
proxy_pass http://unicorn; | |
} | |
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; | |
} | |
# output compression saves bandwidth | |
gzip on; | |
gzip_http_version 1.0; | |
gzip_comp_level 2; | |
gzip_proxied any; | |
gzip_types text/plain text/html text/javascript text/css text/xml application/x-javascript application/atom+xml; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment