经过艰苦卓绝的努力,终于把MP的企业微信通知给搞定了。 不得不说,比IYUU的微信推送还是漂亮不少~ 要说折腾还是很有意思滴 下面开始介绍配置过程:
【1】事前准备 1.安装、配置好mp的nas一台(废话) 2.公网IP一个(如果本地有静态IP可以省略一些步骤,如果没有就得整个VPS啦)
【2】注册企业微信 填好后除了点[确定],记得还要点[保存]!
【3】VPS配置(本地有固定IP可跳过此步骤) VPS的配置目的是通过固定ip与企业微信服务器进行通信。 首先搞定[接受消息]: VPS配置frps服务端,nas上配置frpc客户端。参考[ Frp官方文档] 然后搞定[发送消息]:VPS配置微信消息代理。 建议都用docker,我使用的docker配置供参考,xxx的地方需要修改:
【3.1】Frps(安装在VPS): - docker run -d --name=frps --restart=always \
- --network host \
- -v /home/xxx/frps/frps.toml:/frp/frps.toml \
- stilleshan/frps
复制代码
frps.toml内容: - bindAddr = "0.0.0.0"
- bindPort = 7000
- #kcpBindPort = 7000
- quicBindPort = 7000
- vhostHTTPPort = 7080
- vhostHTTPSPort = 7443
- transport.maxPoolCount = 2000
- transport.tcpMux = true
- transport.tcpMuxKeepaliveInterval = 60
- transport.tcpKeepalive = 7200
- transport.tls.force = false
- webServer.addr = "0.0.0.0"
- webServer.port = 7500
- webServer.user = "xxxx"
- webServer.password = "xxxxxxxxxxxxxxx"
- webServer.pprofEnable = false
- log.to = "./frps.log"
- log.level = "info"
- log.maxDays = 3
- log.disablePrintColor = false
- auth.method = "token"
- auth.token = "xxxxxxxxxxx"
- allowPorts = [
- { start = 10001, end = 50000 }
- ]
- maxPortsPerClient = 8
- u**acketSize = 1500
- nathole**ysisDataReserveHours = 168
- subdomainHost = "xxx.xxx.xxx"
复制代码
【3.2】Frpc(安装在nas): - docker run -d --name=frpc --restart=always \
- --network host \
- -v /xxx/docker/frpc/frpc.toml:/frp/frpc.toml \
- stilleshan/frpc
复制代码
frpc.toml内容: - serverAddr = " xxx.xxx.xxx "
- serverPort = 7000
- auth.method = "token"
- auth.token = " xxxxxx"
- webServer.addr = "127.0.0.1"
- webServer.port = 7400
- webServer.user = "xxx"
- webServer.password = "xxx.xxx.xxx"
- [[proxies]]
- name = "mp.web"
- type = "http"
- localIP = " xxx.xxx.xxx "
- #nas局域网IP
- localPort = 3000
- #默认3000
- subdomain = "mp"
复制代码
【3.3】微信消息代理(安装在VPS) - docker run -d \
- --name wxchat \
- --restart=always \
- -p 6080:80 \
- ddsderek/wxchat:latest
复制代码
VPS的防火墙配置、nginx反代配置不再赘述,请酌情自行设置,反正能通就行 Ps:能通的标准是 能够在mp.xxx.xxx.xxx(:7080)杠api杠v1杠message杠?token=xxx打开显示{"status":"OK"}, 在xxx.xxx.xxx(:6080)打开显示微信代理搭建成功!。
【4】收尾工作 1.在企业微信后台[接受消息]成功保存“消息回调设置” 2.在企业微信后台[企业可信IP]添加自己VPS的IP 3.在mp消息配置[代理地址一栏]填入http冒号杠杠xxx.xxx.xxx(:6080),确定、保存 4.重启mp
恭喜你,终于完工了! Ps:如果你有本地固定IP,可以跳过【3.x】直接进行【4】的设置,可信IP填自己本地的固定IP即可。
|