ยง2024-06-04

Ask chatGPT,

I have a running nextCloud at http://hc4noble.yushei.net:45101/. and my /etc/haproxy/haproxy.cfg

global
    log /dev/log    local0
    log /dev/log    local1 notice
    chroot /var/lib/haproxy
    stats socket /run/haproxy/admin.sock mode 660 level admin
    stats timeout 30s
    user haproxy
    group haproxy
    daemon

defaults
    log     global
    mode    http
    option  httplog
    option  dontlognull
    timeout connect 5000
    timeout client  50000
    timeout server  50000
    # ubuntu uses /etc/haproxy/errors/ directories
    # the followings are for ubuntu
    errorfile 400 /usr/share/haproxy/examples/errorfiles/400.http
    errorfile 403 /usr/share/haproxy/examples/errorfiles/403.http
    # HAProxy does not inherently generate 404 errors but can relay them from backend servers to clients.
    # errorfile 404 /usr/share/haproxy/examples/errorfiles/404.http
    errorfile 408 /usr/share/haproxy/examples/errorfiles/408.http
    errorfile 500 /usr/share/haproxy/examples/errorfiles/500.http
    errorfile 502 /usr/share/haproxy/examples/errorfiles/502.http
    errorfile 503 /usr/share/haproxy/examples/errorfiles/503.http
    errorfile 504 /usr/share/haproxy/examples/errorfiles/504.http

frontend https_front
    # bind *:443 ssl crt /etc/letsencrypt/live/munetaka.me/fullchain.pem key /etc/letsencrypt/live/munetaka.me/privkey.pem
    bind *:443 ssl crt /etc/letsencrypt/live/munetaka.me/haproxy.pem
    default_backend local_nginx


backend local_nginx
    option ssl-hello-chk
    server nginx_server 127.0.0.1:8080 ssl verify none

How to make it so that https://munetaka.me:45101 will use backend server http://hc4noble.yushei.net:45101/.