-
-
Save poc7667/6ab790bad9c693516c5a to your computer and use it in GitHub Desktop.
MB puma + Nginx settings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /config/puma.rb | |
app = "manabalss" # App-specific | |
root = "/home/deployer/apps/#{app}" | |
workers 5 | |
threads 1, 1 # relying on many workers for thread-unsafe apps | |
rackup DefaultRackup | |
port 11592 | |
environment ENV['RACK_ENV'] || 'production' | |
daemonize true | |
pidfile "#{root}/puma/puma.pid" | |
stdout_redirect "#{root}/puma/puma.log", "#{root}/puma/puma_error.log" | |
bind "unix:/tmp/puma.socket" | |
# config/deploy/nginx.conf | |
upstream puma { | |
server unix:/tmp/puma.socket fail_timeout=1; | |
} | |
# This block redirects http requests to https version | |
server { | |
listen 37.139.0.211:80 default deferred; | |
server_name www.manabalss.lv, manabalss.lv; | |
return 307 https://manabalss.lv$request_uri; | |
} | |
server { | |
listen 37.139.0.211:443 ssl; | |
server_name manabalss.lv; | |
ssl_certificate /etc/ssl/server.crt; | |
ssl_certificate_key /etc/ssl/server.key; | |
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; | |
ssl_ciphers RC4:HIGH:!aNULL:!MD5; | |
ssl_session_cache shared:SSL:15m; | |
ssl_session_timeout 15m; | |
root /home/deployer/apps/manabalss/current/public; | |
location ^~ /assets/ { | |
gzip_static on; | |
gzip_vary on; | |
expires max; | |
add_header Cache-Control public; | |
} | |
try_files $uri/index.html $uri @puma; | |
location @puma { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto https; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_pass http://puma; | |
} | |
error_page 500 502 503 504 /500.html; | |
client_max_body_size 4G; | |
keepalive_timeout 10; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment