Skip to content

Instantly share code, notes, and snippets.

@osnysantos
Last active August 29, 2015 14:18
Show Gist options
  • Save osnysantos/5d10898f0ade4fd929a9 to your computer and use it in GitHub Desktop.
Save osnysantos/5d10898f0ade4fd929a9 to your computer and use it in GitHub Desktop.
events {
worker_connections 1024;
}
http {
upstream myapp {
server unix:///home/myapp/apps/www.myapp.com/shared/tmp/sockets/myapp.sock;
}
server {
listen 80 default_server deferred;
# server_name example.com;
rails_env production;
root /home/myapp/apps/www.myapp.com/current/public;
access_log /home/myapp/apps/www.myapp.com/current/log/nginx.access.log;
error_log /home/myapp/apps/www.myapp.com/current/log/nginx.error.log info;
location /portal {
alias /home/myapp/apps/www.myapp.com/current/public;
# try_files $uri/index.html $uri.html $uri @myapp;
try_files $uri/index.html $uri @myapp;
}
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
location @myapp {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://myapp;
rewrite ^/(.*) /portal/$1 redirect;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 20M;
keepalive_timeout 10;
}
}
#!/usr/bin/env puma
# start puma with:
# RAILS_ENV=production bundle exec puma -C ./config/puma.rb
application_path = '/home/myapp/apps/www.myapp.com/current/'
directory application_path
environment 'production'
daemonize true
pidfile "#{application_path}/tmp/pids/puma.pid"
state_path "#{application_path}/tmp/pids/puma.state"
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
bind "unix://#{application_path}/tmp/sockets/myapp.sock"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment