游客
NGINX负载均衡代码

NGINX负载均衡代码

33
0

升级系统
centos

yum update

debian

apt-get update

下载nginx源(centos)

rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

安装(centos)

yum install nginx -y

(debian)

apt-get install nginx -y

运行nginx
(centos)

systemctl start nginx.service

(debian)

service nginx start
mkdir -p /etc/nginx/tcpconf.d

vi /etc/nginx/tcpconf.d/ssrproxy.conf

echo "include /etc/nginx/tcpconf.d/*.conf;" >> /etc/nginx/nginx.conf

关闭防火墙

systemctl stop firewalld.service

开机禁止启动防火墙

systemctl disable firewalld.service

编辑

vi /etc/nginx/tcpconf.d/ssrproxy.conf

重启

systemctl restart nginx

service nginx restart

开机启动

systemctl enable nginx.service

定时任务

crontab -e

0 */6 * * * systemctl restart nginx

stream {
    upstream hk {
        server 2222:42194;
        server 3333:55689;
        server 44444:55866;
        server 55555:44562;
    }
    server {
        listen 11040;
        listen 11040 udp;
        proxy_pass hk;
    }
}
  • 本文作者:404
  • 本文链接: https://404.bz/?post=4
  • 版权声明:本博客所有文章除特别声明外,均默认采用 CC BY-NC-SA 4.0 许可协议。
0
0
关于作者
404
7
0
0
0
内卷太严重,已躺平...

debian11的apt-get update报错

上一篇

哪吒监控 V1 宝塔安装教程

下一篇