Skip to content

Instantly share code, notes, and snippets.

@ffaerber
Created May 11, 2011 17:22
Show Gist options
  • Select an option

  • Save ffaerber/966908 to your computer and use it in GitHub Desktop.

Select an option

Save ffaerber/966908 to your computer and use it in GitHub Desktop.
unicorn_server with nginx
upstream unicorn_server {
# This is the socket we configured in unicorn.rb
server unix:/tmp/.sock fail_timeout=0;
}
server {
listen 80;
keepalive_timeout 5;
client_max_body_size 4G;
server_name <%= node[:hostname] %>;
access_log <%= node[:nginx][:log_dir] %>/localhost.access.log;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
# Location of our static files
root /srv/railsindacloud/current/public;
# 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;
}
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /srv/railsindacloud/current/public;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment