当前位置:   article > 正文

windows 开启pac,完成规则代理_pac脚本

pac脚本

特别鸣谢

10分钟搭建linux代理服务器_三雷科技的博客-CSDN博客

Windows7/10/11 Pac代理脚本及配置_pac脚本_ylf尘风的博客-CSDN博客

1. 代理服务器搭建

yum install tinyproxy

代理服务器,配置
编辑配置/etc/tinyproxy/tinyproxy.conf:
(1)找到Allow 127.0.0.1行,前面加上#号将其注释掉。
(2)Port 8888:默认开放的端口为8888(可自行更改)
   执行/etc/init.d/tinyproxy restart使配置生效,或者执行systemctl restart tinyproxy.service
 

2.客户端windows pac配置

脚本编写proxy.pac

  1. function FindProxyForURL(url, host) {
  2. var proxy = "PROXY 192.168.2.190:8888";
  3. //本地地址直接连接
  4. if (isPlainHostName(host)) {
  5. return "DIRECT";
  6. }
  7. // 代理
  8. if (shExpMatch(url, "*baidu.com*")) {
  9. return proxy;
  10. }
  11. }
  12. //没有匹配上的都直接连接
  13. return "DIRECT";
  14. }

1).修改注册表
以下内容保为pac.reg,双击。或手动修改注册表。

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings]
"EnableLegacyAutoProxyFeatures"=dword:00000001

2).修改自动配置脚本的地址类似
例子中proxy.pac文件放在e盘根目录。需要根据具体情况修改。

file://c:\proxy.pac

配置重启生效(可选)

  1. @echo off
  2. color 0a
  3. title Use autoconfig script
  4. echo Starting......
  5. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
  6. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections" /v DefaultConnectionSettings /t REG_BINARY /d 46000000020000000900 /f
  7. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections" /v SavedLegacySettings /t REG_BINARY /d 46000000020000000900 /f
  8. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /d "file://c:\proxy.pac" /f
  9. echo End
  10. @echo off

如果脚本访问不到,可以使用everything解决

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/593919
推荐阅读
相关标签
  

闽ICP备14008679号