本文共 1074 字,大约阅读时间需要 3 分钟。
Nginx1.9 版本以后增加 stream模块,可以对tcp,udp请求进行代理和负载均衡了
1、安装2、配置
#vim /usr/local/nginx/conf/nginx.confworker_processes auto;error_log /usr/local/nginx/logs/error.log error;events { worker_connections 1024;}stream { log_format main '$remote_addr [$time_local]'' $protocol $status $bytes_sent $bytes_received''$session_time $upstream_addr $upstream_bytes_sent''$upstream_bytes_received $upstream_connect_time';upstream backend { #hash $remote_addr consistent;least_conn;server 127.0.0.8:50179;server 127.0.0.9:50179;server 127.0.0.248:50179;server 127.0.0.249:50179;server 127.0.0.32:50179;server 127.0.0.33:50179;server 127.0.0.34:50179;server 127.0.0.35:50179;server 127.0.0.36:50179;server 127.0.0.8:50179;}server { listen 1080; access_log /usr/local/nginx/logs/access.log main; proxy_pass backend;}
}
3、启动:转载于:https://blog.51cto.com/13718151/2107254