Skip to content

Instantly share code, notes, and snippets.

@foyo23
Last active August 29, 2015 14:02
Show Gist options
  • Save foyo23/5f4350b43abe745e3602 to your computer and use it in GitHub Desktop.
Save foyo23/5f4350b43abe745e3602 to your computer and use it in GitHub Desktop.
nginx submodule config file ( railsapp-nginx.conf )
upstream railsapp {
server unix:/home/appuser/app/shared/pids/unicorn.socket;
}
server {
listen 80;
server_name localhost;
location / {
root /home/appuser/app/current/public/;
index index.html index.htm;
try_files $uri/index.html $uri.html $uri @cluster;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location @cluster {
proxy_pass http://railsapp;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
}
location ~* \.(gif|jpg|jpeg|png|js|css)?$ {
root /home/appuser/app/current/public/;
expires 1h;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment