
我正在嘗試在 CoTURN 前面添加一個 Nginx UDP LoadBalancer。
- 在虛擬機器中安裝 ejabberd
- 在虛擬機器中安裝 nginx
- 在虛擬機器中安裝 coturn
Nginx 設定:
log_format basic '$remote_addr [$time_local] '
'$protocol $status $bytes_sent $bytes_received '
'$session_time';
# Enable access_log statements for debugging
access_log /var/log/nginx/stream.log basic buffer=32k;
upstream stream_cluster {
# hash $remote_addr consistent;
least_conn;
server 30.40.50.60:3478;
server 30.40.50.61:3478;
}
server {
listen 3478 udp reuseport;
listen 3478;
#All UDP/TCP traffic will be forwarded to the cluster
proxy_buffer_size 4096k;
proxy_responses 0;
proxy_bind $remote_addr transparent;
proxy_protocol on;
proxy_pass stream_cluster;
allow all;
# error_log /var/log/nginx/stream.log;
}
直接與 ejabberd 一起使用時,coturn 運作得很好。所有必需的連接埠均在安全性原則中開啟。但 nginx 並沒有將資料傳遞到上游。我遵循了 nginx 官方文件。
不確定我做錯了什麼。