Last active
March 29, 2017 07:12
-
-
Save EvgenyKungurov/db72d249ea352a5be333e2a9a6494faf to your computer and use it in GitHub Desktop.
RoR + NginX + Puma
This file contains 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
#/etc/nginx/sites-available/esrc-chita.ru | |
upstream esrc-chita.ru { | |
server unix:///home/esrc/esrc-chita.ru/tmp/sockets/puma.sock; | |
} | |
server { | |
listen 80 default_server; | |
server_name esrc-chita.ru; | |
return 301 https://esrc-chita.ru$request_uri; | |
rewrite ^(.*) https://zaraki.ru$uri permanent; | |
} | |
server { | |
listen 443 ssl; | |
ssl on; | |
server_name esrc-chita.ru; | |
root /home/esrc/esrc-chita.ru/public; | |
error_log /home/esrc/esrc-chita.ru/log/nginx_error.log error; | |
access_log /home/esrc/esrc-chita.ru/log/nginx_access.log combined; | |
client_max_body_size 128M; | |
ssl_certificate /etc/letsencrypt/live/esrc-chita.ru/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/esrc-chita.ru/privkey.pem; | |
ssl_protocols TLSv1.2 TLSv1.1 TLSv1; | |
ssl_session_cache shared:SSL:20m; | |
ssl_session_timeout 10m; | |
ssl_ciphers 'EECDH+ECDSA+AESGCM:AES128+EECDH:AES128+EDH:!RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!CAMELLIA:!ADH'; | |
ssl_prefer_server_ciphers on; | |
resolver 8.8.8.8 8.8.4.4 valid=300s; | |
resolver_timeout 10s; | |
ssl_stapling on; | |
location / { | |
proxy_pass http://esrc-chita.ru; | |
proxy_set_header Host $host; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Ssl on; | |
} | |
location ~* ^/(ckeditor_assets|assets|images|javascripts|stylesheets|system)/ { | |
expires 1y; | |
add_header Cache-Control public; | |
add_header Last-Modified ""; | |
add_header ETag ""; | |
gzip_static on; | |
} | |
} | |
This file contains 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
#/etc/puma.conf | |
environment 'production' | |
app_path = '/home/esrc/esrc-chita.ru' | |
directory app_path | |
stdout_redirect "#{app_path}/log/puma.stdout.log", "#{app_path}/log/puma.stderr.log" | |
threads 5,5 | |
bind "unix://#{app_path}/tmp/sockets/puma.sock" | |
This file contains 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
# /etc/systemd/system/puma.service | |
[Unit] | |
Description=Puma server | |
After=network.target | |
[Service] | |
ExecStart=/home/esrc/.rvm/bin/rvm-auto-ruby /home/esrc/.rvm/gems/ruby-2.3.1/bin/puma -C /etc/puma.conf | |
[Install] | |
WantedBy=multi-user.target | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment