Skip to content

Instantly share code, notes, and snippets.

@KuJoe
Created January 12, 2023 14:33
Show Gist options
  • Save KuJoe/60e6e3fa92d8b02543becc001f3eb25b to your computer and use it in GitHub Desktop.
Save KuJoe/60e6e3fa92d8b02543becc001f3eb25b to your computer and use it in GitHub Desktop.
nginx reverse proxy config
server {
server_name example.com;
access_log off;
error_log off;
location / {
proxy_pass http://my.synology.ddns
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
}
error_page 501 502 503 /index.html;
location = /index.html {
root /var/www/html;
}
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;
return 404; # managed by Certbot
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment