Skip to content

Instantly share code, notes, and snippets.

@flyerhzm
Created October 21, 2014 08:31
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 flyerhzm/0d836d8e60d5673872b7 to your computer and use it in GitHub Desktop.
Save flyerhzm/0d836d8e60d5673872b7 to your computer and use it in GitHub Desktop.
nginx with unicorn conf
upstream codingstyleguide_upstream {
server unix:///home/deploy/sites/codingstyleguide/production/shared/tmp/sockets/puma.sock;
}
server {
listen 80;
server_name codingstyleguide-assets.xinminlabs.com;
access_log /var/log/nginx/codingstyleguide-asset.log;
error_log /var/log/nginx/codingstyleguide-error.log;
root /home/deploy/sites/codingstyleguide/production/current/public;
# expires headers
location ~ ^/assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
break;
}
}
server {
listen 80;
server_name codingstyleguide.xinminlabs.com;
access_log /var/log/nginx/codingstyleguide-access.log;
error_log /var/log/nginx/codingstyleguide-error.log;
root /home/deploy/sites/codingstyleguide/production/current/public;
# expires headers
location ~ ^/assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
break;
}
location / {
proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header Host $http_host;
proxy_pass http://codingstyleguide_upstream;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment