Skip to content

Instantly share code, notes, and snippets.

@marcocarvalho
Created December 31, 2015 00:40
Show Gist options
  • Save marcocarvalho/fa7cc7c4e3c490a05c58 to your computer and use it in GitHub Desktop.
Save marcocarvalho/fa7cc7c4e3c490a05c58 to your computer and use it in GitHub Desktop.
upstream unicorn_server {
server unix:/tmp/unicorn.sock fail_timeout=0;
}
server {
listen 80;
root /usr/src/app/public;
try_files $uri @unicorn_server;
location @unicorn_server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
#proxy_set_header X-Forwarded-Proto https; # if use ssl
proxy_redirect off;
proxy_pass http://unicorn_server;
}
location ~ ^/(assets|images|javascripts|stylesheets|swfs|system)/ {
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