Ubuntu设置pac全局代理
2019-06-02 14:11:50

本机环境

1
2
3
4
Distributor ID:	Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
  1. 安装genpac
1
pip3 install genpac
  1. 创建目录用于存放相关文件
1
2
3
mkdir ssrPAC
cd ssrPAC
touch user-rules.txt
  1. 生成pac文件
1
genpac -p "SOCKS5 127.0.0.1:1080" --gfwlist-proxy="SOCKS5 127.0.0.1:1080" --output="autoproxy.pac" --gfwlist-url="https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt" --user-rule-from="user-rules.txt"
  1. 设置全局代理
    打开System setting > Network > Network Proxy
    将Method改为Automatic
    并在Configuration URL填入以下内容:
1
file:///home/roger-hwong/software/ssrPAC/autoproxy.pac

即“file://” + autoproxy.pac文件的绝对路径

参考

ubuntu基于shadowsocks的PAC全局代理:解决方案