正反向代理工具squid

问题:内网服务器没法调用钉钉机器人接口

解决思路:找一个代理服务器,通过外网服务器转发内网服务器的请求

解决方法:利用squid的正向代理功能,将内网请求通过外网转发出去

1、在外网服务器安装:

yum  -y install squid

配置文件:   /etc/squid/squid.conf

启动方式: service squid  start

2、在内网服务器配置代理转发:

vim /root/.bashrc

export http_proxy=http://192.168.125.10:3128   #squid默认端口为3128  可以在配置文件中修改
export https_proxy=http://192.168.125.10:3128

读取环境变量:  source  /root/.bashrc

3、内网服务器调用钉钉接口:

curl 'https://oapi.dingtalk.com/robot/send?access_token=db2cde8b4c85c602d36060f524787fe42f216f47cb8e13641d26bc76074e7e77' -H 'Content-Type: application/json' -d '{"msgtype": "text", "text": {"content": "BI数据库没有启动 3306端口检测不到了  数据同步延迟时间:'"$Seconds"'"},"at": {"atMobiles":["18636021897"],"isAtAll": false}}'

squid工作原理待续

posted @ 2021-05-13 10:06  天宇星空  阅读(383)  评论(0编辑  收藏  举报