1.升级nginx 版本至1.9.0以上

升级流程参考 nginx平滑升级 

2.配置编译的时候需要加上

1  ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-stream
2 make
3 cp ./objs/nginx /usr/local/nginx/sbin/
4 make upgrade

3.修改配置文件

stream 
{
    upstream cloudsocket 
    {
    hash $remote_addr consistent;
    server 10.x.xx.14:1831 weight=5 max_fails=3 fail_timeout=30s;
    }
server 
    {
    listen 8081;
    proxy_connect_timeout 1s;
    proxy_timeout 3s;
    proxy_pass cloudsocket;
    }
}
stream 与 http 是一个层级的,放在配置文件最后
4.重启服务
[root@t-scrmap1-v-szzb nginx]# ./sbin/nginx -s reload

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
  • 2021-11-04
  • 2021-07-19
  • 2021-05-06
  • 2022-02-23
  • 2021-11-26
猜你喜欢
  • 2022-12-23
  • 2022-02-23
  • 2021-11-07
  • 2021-07-16
  • 2022-12-23
  • 2022-12-23
  • 2021-06-29
相关资源
相似解决方案