Skip to content

Instantly share code, notes, and snippets.

@will118
Created November 2, 2013 14:39
Show Gist options
  • Save will118/7279548 to your computer and use it in GitHub Desktop.
Save will118/7279548 to your computer and use it in GitHub Desktop.
nginx conf for Rails/Puma
upstream app_server {
server unix:///var/run/my_app.sock;
}
server {
listen 80;
root /home/epldb/public;
server_name _;
index index.htm index.html;
location / {
try_files $uri/index.html $uri.html $uri @app;
}
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mp3|flv|mpeg|avi)$ {
try_files $uri @app;
}
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server;
}
}
bundle exec puma -e development -b unix:///var/run/my_app.sock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment