# port 43889, http://h2Jammy.yushei.net:43889 Caddy Markdown Dir Server

# backend_servers will not work
# upstream backend_servers 
# upstream backend_servers_43889 {
#      server h2Jammy.yushei.net:43889 weight=3;
#      # server h2jammy-01.yushei.net:43889 weight=1;
# }

server {
     server_name  munetaka.me:43889;
     charset utf-8;

     location / {
        proxy_pass http://h2Jammy.yushei.net:43889;
	# proxy_pass http://backend_servers_43889; # Failed to work
        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 https;
        proxy_set_header X-Forwarded-Host munetaka.me;
        proxy_set_header X-Forwarded-Port 43889;
     }

     listen 43889 ssl; # managed by Certbot
     ssl_certificate /etc/letsencrypt/live/munetaka.me/fullchain.pem; # managed by Certbot
     ssl_certificate_key /etc/letsencrypt/live/munetaka.me/privkey.pem; # managed by Certbot
}

# port 42103,  http://munetaka.me:42101, http://chingyen.com.tw:42101, JupyterHub

# upstream backend_servers !! not working
# upstream backend_servers_42103 {
#     server munetaka.me:42101 weight=3;
#     server chingyen.com.tw:42101 weight=1;
# }

server {
     server_name  munetaka.me:42103;
     charset utf-8;

     location / {
        proxy_pass http://munetaka.me:42101;
        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 https;
        proxy_set_header X-Forwarded-Host munetaka.me;
        proxy_set_header X-Forwarded-Port 42103;
     }

     listen 42103 ssl; # managed by Certbot
     ssl_certificate /etc/letsencrypt/live/munetaka.me/fullchain.pem; # managed by Certbot
     ssl_certificate_key /etc/letsencrypt/live/munetaka.me/privkey.pem; # managed by Certbot  
}