Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
updated nginx config
# setup a upstream point to CodiMD server
upstream @codimd {
keepalive 300;
# for (http upgrade)
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
server {
listen 80;
listen [::]:80;
return 302$request_uri;
server {
#listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
location / {
proxy_http_version 1.1;
# set header for proxy protocol
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 Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
# setup for image upload
client_max_body_size 8192m;
proxy_max_temp_file_size 8192m;
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_pass http://@codimd;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment