NANOPI R1S H5 安装OpenWrt 带Passwall,并且设置HAProxy做负载均衡的方法

更详细的说明可以参考YouTuBe视频

在网上找了N多的刷机包,好不容易找到带Passwall的,结果是阉割版,里面没有带HAProxy,要知道这东西可是一大神器,随便挂一两个结点没问题
看来只有手动安装了,首先登录你的路由器,安装haproxy

opkg update
opkg install haproxy

装好后,Passwall里面的负载均衡终于出现了
《NANOPI R1S H5 安装OpenWrt 带Passwall,并且设置HAProxy做负载均衡的方法》
它的启动参数是这样的 /usr/sbin/haproxy -f /var/etc/passwall/haproxy.cfg ,这里的/var/etc/passwall/haproxy.cfg是Passwall自动临时产生的,和原装的HAProxy位置是不一样的.

有一个核心问题一定要注意,就是添加以域名类型的节点,一定要能正常解析,要不然HAProxy启动不成功
——————————–
上面是针对固件带Passwall的情况,那么如果你的固件没有Passwall能不能用HAProxy呢,答案也是可以的,你用SSR PLUS+也没问题,只不过你得进入全手动操作
安装方法和上面一样,只不过服务器配置文件你就得一个一个的自己输了
安装好后,运行和设置开机自启动

/etc/init.d/haproxy enable  #开机启动haproxy
/etc/init.d/haproxy start   #启动haproxy

然后你在SSR 或者 v2ray里把服务器IP设置成127.0.0.1就行了,其它参数自行根据情况配置

HAProxy默认的配置文件路径在这里 /etc/haproxy.cfg
下面贴上我的配置文件示例

global
    log         127.0.0.1 local2

    chroot      /root
    pidfile     /tmp/haproxy.pid
    maxconn     4000
    user        root
    daemon

listen admin_stats
        stats   enable
        bind    *:1188   #监听的ip端口号
        mode    http    #开关
        option  httplog
        log     global
        maxconn 10
        stats   refresh 5s   #统计页面自动刷新时间
        stats   uri /admin    #访问的uri   ip:1188/admin
        stats   realm haproxy
        stats   auth admin:admin  #认证用户名和密码
        #stats   hide-version   #隐藏HAProxy的版本号
        stats   admin if TRUE   #管理界面,如果认证成功了,可通过webui管理节点

defaults
    mode                    tcp    #TCP模式
    log                     global
    option                  tcplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 2
    timeout http-request    10s
    timeout queue           1m
    timeout connect         2s     #上游TCP服务器连接等待时间                                      
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 3000

listen server_list
    bind 0.0.0.0:8388       #haproxy监听端口
    mode tcp
    server hk1-BGP hk1.1633.com:31451 weight 5 check inter 1500 rise 1 fall 3
    server hk2-BGP hk2.1633.com:50000 weight 5 check inter 1500 rise 1 fall 3
    server hk3-BGP hk3.1633.com:31451 weight 5 check inter 1500 rise 1 fall 3
    server hk4-BGP hk4.1633.com:50000 weight 5 check inter 1500 rise 1 fall 3



  1. SH说道:

    R1S H5 OpenWrt 带Passwall的固件哪里找的?能分享下吗,谢谢

发表评论

您的电子邮箱地址不会被公开。

11 + = 12