Skip to content

Instantly share code, notes, and snippets.

@pedro108
Last active March 2, 2016 17:18
Show Gist options
  • Save pedro108/b4fff3db8f33ac363b26 to your computer and use it in GitHub Desktop.
Save pedro108/b4fff3db8f33ac363b26 to your computer and use it in GitHub Desktop.
upstream unicorn {
server unix:#{path_to_rails_app_current_root}/tmp/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server #{application.domain.name};
keepalive_timeout 300;
client_max_body_size 4G;
root #{path_to_rails_app_current_root}/public; # Set this to the public folder location of your Rails application.
try_files $uri/index.html $uri.html $uri @unicorn;
location @unicorn {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded_Proto $scheme;
proxy_redirect off;
# This passes requests to unicorn, as defined in /etc/nginx/nginx.conf
proxy_pass http://unicorn;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment