Skip to content

Instantly share code, notes, and snippets.

@brandonhilkert
Created July 1, 2011 12:58
Show Gist options
  • Save brandonhilkert/1058496 to your computer and use it in GitHub Desktop.
Save brandonhilkert/1058496 to your computer and use it in GitHub Desktop.
Nginx config for Unicorn
upstream unicorn {
server unix:/tmp/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name staging.meeteor.com;
root /vol/data/rails/meeteor_production/current/public/;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
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 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://unicorn;
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment