Created
April 12, 2018 21:14
-
-
Save DSKonstantin/604805b857ebeaf6684bf1b96b0dfa2b to your computer and use it in GitHub Desktop.
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
upstream puma { | |
server unix:///root/cheapsea/shared/tmp/sockets/cheapsea-puma.sock; | |
} | |
server { | |
#listen 80 default_server deferred; | |
#server_name cheapsea.net; | |
listen 443 ssl http2; | |
listen [::]:443 ssl http2; | |
ssl_certificate /etc/letsencrypt/live/cheapsea.net/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/cheapsea.net/privkey.pem; | |
root /root/cheapsea/current/public; | |
access_log /root/cheapsea/current/log/nginx.access.log; | |
error_log /root/cheapsea/current/log/nginx.error.log info; | |
location ^~ /.well-known { | |
allow all; | |
auth_basic off; | |
alias /home/root/cheapsea/current/public/.well-known/; | |
} | |
location ^~ /assets/ { | |
gzip_static on; | |
expires max; | |
add_header Cache-Control public; | |
} | |
#try_files $uri/index.html $uri @puma; | |
#location @puma { | |
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
# proxy_set_header Host $http_host; | |
# #proxy_redirect off; | |
# proxy_set_header X-Forwarded-Proto $scheme; | |
# proxy_set_header X-Forwarded-Ssl on; | |
# proxy_set_header X-Forwarded-Proto-Version $http2; | |
# proxy_pass http://puma; | |
#} | |
location / { | |
if ($scheme = http) { | |
return 301 https://$server_name$request_uri; | |
} | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_set_header X-Forwarded-Ssl on; | |
proxy_set_header X-Forwarded-Proto-Version $http2; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_pass http://puma; | |
} | |
error_page 500 502 503 504 /500.html; | |
client_max_body_size 10M; | |
keepalive_timeout 10; | |
} | |
server { | |
listen 80; | |
server_name cheapsea.net; | |
return 301 https://$server_name$request_uri; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment