[TOC]
# 代理rabbitmq
Nginx编译需要加`--with-stream`模块,以下配置要与http模块平级
```
stream{
upstream rabbitmq_api {
server 172.30.2.10:5672 weight=1;
}
server {
listen 11181;
proxy_pass rabbitmq_api;
}
}
```
# 代理websocket
注意:如果经过多个Nginx,则每个Nginx都要加上这个配置
```
location /webSocket {
proxy_pass http://172.30.2.13:11173;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
//以下必加,升级HTTP协议到websocket
proxy_http_version 1.1;
proxy_set_header Upgrade "websocket";
proxy_set_header Connection "upgrade";
}
```