nginx反向代理socket配置
1,安装
git clone https://github.com/yaoweibin/nginx_tcp_proxy_module cd nginx-1.8.1patch -p1 < /root/to/nginx_tcp_proxy_module/tcp.patch./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_perl_module --add-module=/root/nginx_tcp_proxy_modulemake && make install
2,配置
TCP是独立模块,不可在http模块中
events {worker_connections 1024; }tcp {upstream cluster{server x.x.x.x:x;check interval=3000 rise=2 fall=5 timeout=1000; }server {listen 8181;proxy_pass cluster;} }http {include mime.types;default_type application/octet-stream;
重启nginx即可
END!