Skip to content

Instantly share code, notes, and snippets.

@alobato
Last active June 28, 2017 18:45
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 alobato/4731bf5d61bec8db8866384c9b53e81e to your computer and use it in GitHub Desktop.
Save alobato/4731bf5d61bec8db8866384c9b53e81e to your computer and use it in GitHub Desktop.
# use the socket we configured in our puma.rb
upstream puma_appname {
server unix:/home/deployer/apps/appname/shared/sockets/puma.sock fail_timeout=0;
}
server {
listen 80;
server_name domain;
root /home/deployer/apps/appname/current/public;
try_files $uri/index.html $uri @puma_appname;
error_page 500 502 503 504 /500.html;
# maximum accepted body size of client request
client_max_body_size 4G;
# the server will close connections after this time
keepalive_timeout 10;
access_log /dev/null;
error_log /dev/null;
location @puma_appname {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
# pass to the upstream puma server mentioned above
proxy_pass http://puma_appname;
}
# http://stackoverflow.com/a/6952804
# https://gist.github.com/mikhailov/3052776
# http://stackoverflow.com/a/7411613
# http://guides.rubyonrails.org/asset_pipeline.html#precompiling-assets
location ~ ^/assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
add_header Last-Modified "";
add_header ETag "";
# open_file_cache max=1000 inactive=500s;
# open_file_cache_valid 600s;
# open_file_cache_errors on;
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment