nginx实现两层代理转发
时间: 2023-12-23 07:27:13 浏览: 243
nginx 代理转发
以下是nginx实现两层代理转发的示例配置:
```nginx
http {
upstream backend_servers {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
}
server {
listen 80;
location / {
proxy_pass http://backend_servers;
}
}
}
```
stream {
upstream stream_backend {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
}
server {
listen 12345;
proxy_pass stream_backend;
}
}
```
阅读全文