Created
December 27, 2021 04:01
-
-
Save tomstorms/304aa5a94f617280ff7c42bfcae06dd2 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
# Note: Use at your own risk. Always make a full backup before you start. | |
#----------------------------------------------------- | |
# Upstream to proxy site | |
location / { | |
# First attempt to serve request as file, then | |
# as directory, then fall back to displaying a 404. | |
# try_files $uri $uri/ =404; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-NginX-Proxy true; | |
proxy_pass http://127.0.0.1:8181; | |
proxy_redirect off; | |
} | |
#----------------------------------------------------- | |
# Redirect domain to another site | |
# | |
# Note: You'll need to generate an SSL cert to redirect https redirects | |
# | |
### my-website.com ### | |
server { | |
# Redirect to HTTPS | |
listen 80; | |
listen [::]:80; | |
server_name www.my-website.com my-website.com; | |
return 302 https://$server_name$request_uri; | |
} | |
server { | |
listen 443; | |
listen [::]:443; | |
server_name www.my-website.com my-website.com; | |
ssl_certificate /etc/letsencrypt/live/my-website.com/fullchain.pem; # managed by Certbot | |
ssl_certificate_key /etc/letsencrypt/live/my-website.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 | |
rewrite ^ https://www.my-website.com/supply/ permanent; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment