< 返回技术文档列表

nginx开启4层代理商设置

发布时间:2022-11-17 22:57:53⊙投诉举报
  1. 升级nginx的源文件
cat>/etc/yum.repos.d/nginx.repo<<EOF[nginx-stable]name=nginx stable repobaseurl=http://nginx.org/packages/centos/\$releasever/\$basearch/gpgcheck=1enabled=1gpgkey=https://nginx.org/keys/nginx_signing.keyEOF
  1. 安装nginx
yum -y install nginx
  1. 修改nginx配置文件,和http在同一级
stream {  upstream test_mysql {    hash $remote_addr consistent;               # 通过配置一致性 hash 来防止调度异常    server 192.168.0.204:3306 weight=5 max_fails=3 fail_timeout=30s;  }  server {    listen 10086 so_keepalive=on;               # 开启 TCP 存活探测    proxy_connect_timeout 10s;                  # 连接超时时间    proxy_timeout 300s;                         # 端口保持时间    proxy_pass test_mysql;  }}

/template/Home/Zkeys/PC/Static