安装 Squid

yum install -y squid

配置 Squid

vi /etc/squid/squid.conf

http_port 3128
acl payserver src 10.10.22.33 #允许访问的IP 
acl SSL_ports port 443
acl CONNECT method CONNECT
http_access allow payserver CONNECT SSL_ports
http_access deny all

启动 Squid

systemctl enable squid
systemctl restart squid

防火墙放行

firewall-cmd --permanent --add-port=3128/tcp
firewall-cmd --reload

临时测试

export https_proxy=http://前置机IP:3128
curl -v https://api.mch.weixin.qq.com

Docker 配置

nonProxyHosts 根据现场修改

    environment:
      - JAVA_OPTS=-Dhttps.proxyHost=前置机IP -Dhttps.proxyPort=3128 -Dhttp.proxyHost=前置机IP -Dhttp.proxyPort=3128 -Dhttp.nonProxyHosts=localhost|127.*|10.*|172.18.*
文章作者: Captain
版权声明: 本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 One piece
教程
喜欢就支持一下吧