Last active
January 19, 2023 12:49
-
-
Save omairrazam/2a6efdc981feadc8c165438762c9de4d to your computer and use it in GitHub Desktop.
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
upstream puma { | |
server unix:///home/deploy/example/shared/tmp/sockets/example-puma.sock; | |
} | |
server { | |
server_name example.com; | |
root /home/deploy/example/current/public; | |
access_log /home/deploy/example/current/log/nginx.access.log; | |
error_log /home/deploy/example/current/log/nginx.error.log info; | |
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-NginX-Proxy true; | |
proxy_pass http://puma; | |
} | |
location /cable { | |
proxy_pass http://puma; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade websocket; | |
proxy_set_header Connection Upgrade; | |
} | |
auth_basic "Private Property"; | |
auth_basic_user_file /etc/nginx/.htpasswd; | |
error_page 500 502 503 504 /500.html; | |
client_max_body_size 200M; | |
keepalive_timeout 100; | |
listen 443 ssl; # managed by Certbot | |
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot | |
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot | |
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot | |
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot | |
} | |
server { | |
if ($host = example.com) { | |
return 301 https://$host$request_uri; | |
} # managed by Certbot | |
listen 80; | |
server_name example.com | |
root /home/deploy/example/current/public; | |
return 404; # managed by Certbot | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment