Lol*_*lak 9 reverse-proxy nginx rtmp
我正在尝试在 2 个不同的服务器前使用 nginx 代理
example.com , example1.com >> nginx 10.0.0.1 >>>> 10.0.0.2 , 10.0.0.3
stream {
server {
listen 1935;
proxy_pass 10.0.0.2:1936;
proxy_protocol on;
}
server {
listen 1935;
proxy_pass 10.0.0.3:1936;
proxy_protocol on;
}
}
Run Code Online (Sandbox Code Playgroud)
我已经检查了 tcp负载平衡指南,但我找不到如何使它工作
尽管server_nameTCP/UDP 协议中没有,但您可以将流量转发到不同的上游$server_addr。我的例子在这里:https : //stackoverflow.com/a/44821204/5085270
Tan*_*Tat -4
使用该server_name指令确定哪个服务器块用于给定请求。
server {
listen 1935;
server_name example.com;
location / {
proxy_pass 10.0.0.1:1936;
# the usual proxy_* stuff
}
}
server {
listen 1935;
server_name example1.com;
location / {
proxy_pass 10.0.0.2:1936;
# the usual proxy_* stuff
}
}
Run Code Online (Sandbox Code Playgroud)
来源: http: //nginx.org/en/docs/http/server_names.html
| 归档时间: |
|
| 查看次数: |
36559 次 |
| 最近记录: |