Skip to content

Instantly share code, notes, and snippets.

@yangtheman
Created August 18, 2012 08:26
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 yangtheman/3385305 to your computer and use it in GitHub Desktop.
Save yangtheman/3385305 to your computer and use it in GitHub Desktop.
/etc/nginx/rubber/unicorn_nginx.conf
upstream unicorn_server {
# This is the socket we configured in unicorn.rb
server unix:/var/run/unicorn.sock
fail_timeout=0;
}
server {
listen 80;
client_max_body_size 4G;
server_name picpler.com;
keepalive_timeout 5;
# Location of our static files
root /mnt/picpler-production/releases/20120818080220/public;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
# If you don't find the filename in the static files
# Then request it from the unicorn server
if (!-f $request_filename) {
proxy_pass http://unicorn_server;
break;
}
}
# this rewrites all the requests to the maintenance.html
# page if it exists in the doc root. This is for capistrano's
# disable web task
if (-f $document_root/system/maintenance.html)
{
rewrite ^(.*)$ /system/maintenance.html last;
break;
}
error_page 500 502 503 504 /500.html;
location = /500.html
{
root /mnt/picpler-production/releases/20120818080220/public;
}
error_page 404 /404.html;
location = /404.html
{
root /mnt/picpler-production/releases/20120818080220/public;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment