HAProxy
HAProxyは、高性能でよく知られたリバースプロキシです。 最新のHAProxy(2.x以降)は、timeout tunnelを長めに設定していればOwncastのWebSocketチャットを透過的に転送するため、別途WebSocketバックエンドを用意する必要はありません。
下のhaproxy.cfgはポート80と443でTLSを終端し、ポート8080のOwncastへ転送します。 証明書チェーンと秘密鍵を1つのPEMファイルにまとめたものを/etc/haproxy/certs/owncast.pemに配置していることを想定しています。 Let's Encryptを利用する場合、このファイルはcat fullchain.pem privkey.pem > /etc/haproxy/certs/owncast.pemで作成できます。 証明書のパスと、バックエンドアドレス 127.0.0.1:8080 を環境に合わせて変更してください。
haproxy.cfg
global
log /dev/log local0
chroot /var/lib/haproxy
user haproxy
group haproxy
daemon
maxconn 16384
# SSL defaults, see https://ssl-config.mozilla.org/#server=haproxy&config=intermediate
ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256
ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets
defaults
log global
mode http
option httplog
option forwardfor
timeout connect 5s
timeout client 50s
timeout server 50s
# Keep long-lived WebSocket (chat) connections open
timeout tunnel 1h
frontend tls
bind :80
bind :443 ssl crt /etc/haproxy/certs/owncast.pem
# Send all plain HTTP to HTTPS
http-request redirect scheme https code 301 unless { ssl_fc }
default_backend owncast
backend owncast
http-request set-header X-Forwarded-Port %[dst_port]
http-request add-header X-Forwarded-Proto https if { ssl_fc }
server server1 127.0.0.1:8080 check
Improve this page
See something missing or incorrect? Edit this page and improve the documentation for everyone.
Contributors to this documentation

