Ngnix负载均衡

搬瓦工机场JMS

升级系统

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

date

开机启动

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;
    }
}

未经允许不得转载:搬瓦工VPS_美国VPS » Ngnix负载均衡

赞 (0) 打赏

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏