Skip to content

Instantly share code, notes, and snippets.

@forrestgrant
Last active August 29, 2015 14:05
Show Gist options
  • Save forrestgrant/83d798464fd8265828e3 to your computer and use it in GitHub Desktop.
Save forrestgrant/83d798464fd8265828e3 to your computer and use it in GitHub Desktop.
nginx/puma config
# /etc/nginx/sites-available/app.conf
upstream app {
server unix:///var/www/app/tmp/sockets/puma.sock fail_timeout=0;
}
server {
listen 80;
server_name localhost;
root /var/www/app/public;
try_files $uri/index.html $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;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
# /var/www/app/config/puma.rb
APP_PATH = '/var/www/app'
environment ENV['RAILS_ENV'] || 'production'
daemonize true
pidfile "#{APP_PATH}/tmp/pids/puma.pid"
stdout_redirect "#{APP_PATH}/log/production.log", "#{APP_PATH}/log/production.log"
threads 0, 16
bind "unix:///#{APP_PATH}/tmp/sockets/puma.sock"
to start puma
$ cd /var/www/app
$ bundle exec puma
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment