Skip to content

Instantly share code, notes, and snippets.

@terenceponce
Last active August 29, 2015 14:02
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 terenceponce/e23d93ca8ba1db0e2576 to your computer and use it in GitHub Desktop.
Save terenceponce/e23d93ca8ba1db0e2576 to your computer and use it in GitHub Desktop.
Typical Rails nginx configuration
upstream zealous-badger {
server 127.0.0.1:49224;
}
server {
listen [::]:80;
listen 80;
server_name zealous-badger.example.com;
location / {
proxy_pass http://zealous-badger;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Request-Start $msec;
}
location ~ ^/assets/ {
root /home/mydomain.com/current/public;
gzip_static on;
expires max;
add_header Cache-Control public;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment