Skip to content

Instantly share code, notes, and snippets.

@sgtlaggy
Created March 9, 2023 18:04
Show Gist options
  • Save sgtlaggy/e02636f809dee177a86b0d4d745dc98c to your computer and use it in GitHub Desktop.
Save sgtlaggy/e02636f809dee177a86b0d4d745dc98c to your computer and use it in GitHub Desktop.
nginx include example
# /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;
# /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;
# /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