Created
March 9, 2023 18:04
-
-
Save sgtlaggy/e02636f809dee177a86b0d4d745dc98c to your computer and use it in GitHub Desktop.
nginx include example
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
# /etc/nginx/custom/proxy.conf | |
proxy_set_header Host $host; | |
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 $scheme; | |
proxy_set_header X-Forwarded-Protocol $scheme; | |
proxy_set_header X-Forwarded-Host $http_host; |
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
# /etc/nginx/custom/ssl-YOURDOMAIN.conf | |
listen [::]:443 ssl; | |
listen 443 ssl; | |
ssl_certificate /etc/letsencrypt/live/YOURDOMAIN/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/YOURDOMAIN/privkey.pem; | |
include /etc/letsencrypt/options-ssl-nginx.conf; | |
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; |
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
# /etc/nginx/sites-available/YOURDOMAIN | |
server { | |
server_name your.domain; | |
location / { | |
proxy_pass http://localhost:PORT/; | |
include /etc/nginx/custom/proxy.conf; | |
} | |
include /etc/nginx/custom/ssl-YOURDOMAIN.conf; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment