1、下载地址

https://github.com/nginx/nginx

2、解压

tar -xvf  或unzip  

3、编译安装 

./configure --with-stream;make;make install;

4、配置参数

cd /usr/local/nginx/conf

修改nginx.conf

stream 
{
upstream cloudsocket 
{
hash $remote_addr consistent;
server 127.0.0.1:2016 weight=5 max_fails=3 fail_timeout=30s;
server 127.0.0.1:2015 weight=5 max_fails=3 fail_timeout=30s;
}
server 
{
listen 2014;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass cloudsocket;
}
}

5、启动服务

cd /usr/local/nginx/sbin

./nginx
Logo

更多推荐