我使用 brew 通过 Mac OS 终端安装 polipo。似乎安装成功,但我找不到配置文件并对其进行编辑。谁能帮我找出原因?
3 回答
配置文件不会自动创建。您需要获取示例配置文件。在终端中运行此命令:
curl -o ~/.polipo https://raw.githubusercontent.com/jech/polipo/master/config.sample对于禁止的 URL:
curl -o ~/.polipo-forbidden https://raw.githubusercontent.com/jech/polipo/master/forbidden.sample然后重新启动 polipo 以确保它将使用配置文件:
launchctl unload /usr/local/opt/polipo/homebrew.mxcl.polipo.plist launchctl load /usr/local/opt/polipo/homebrew.mxcl.polipo.plist如果它产生
Service is disabled错误,请尝试以下命令重新启动小儿麻痹症:brew services restart polipo现在在浏览器中打开这个地址:http: //127.0.0.1 :8123/polipo/config
您应该在顶部看到这一行:
configFile /Users/YourUserName/.polipo Configuration file.如果是这样,您需要修改
~/.polipo以配置您的 polipo 实例。还有一种方法不推荐。您可以在以下位置创建配置文件,
/usr/local/etc/polipo/config然后/etc/polipo/config使用以下命令创建软链接:mkdir /usr/local/etc/polipo/ curl -o /usr/local/etc/polipo/config https://raw.githubusercontent.com/jech/polipo/master/config.sample sudo ln -sfv /usr/local/etc/polipo/config /etc/polipo/config然后重新启动 polipo 并确保您的配置文件位置正确。您可以修改配置文件在
/usr/local/etc/polipo/config.
我还使用 brew 在 Mac OS 上安装 polipo。和你遇到的一样的问题。
实际上,您需要创建配置文件。失败的路径是~/.polipo.
启动 polipo 服务后( brew services start polipo) 打开链接:http: //127.0.0.1 :8123/polipo/config

socksParentProxy = "127.0.0.1:1086"
socksParentProxy
socksProxyType = socks5
proxyAddress = "::0" # both IPv4 and IPv6
proxyPort = 8123
如果 polipo 不起作用:
我也想安装 polipo,但即使使用此处提供的配置文件,我也得到:
Error: polipo has been disabled because it is not supported upstream!
(MacBook Pro M1 芯片。我的 socks 代理是ssh -D 8000 -C -N myuser@statichost由于一些静态 IP 要求而生成的)。
所以,我发现你也可以使用 npm 包将 socks 代理转换为 http 代理:https ://www.npmjs.com/package/http-proxy-to-socks
# install hpts:
npm install -g http-proxy-to-socks
# launch http proxy:
hpts -s 127.0.0.1:8000 -p 8001
# here my socks5 proxy is at 127.0.0.1:8000 and the http proxy is now on port 8001
例如,Npm 不支持 socks5 代理。所以我使用 hpts 来获得一个 http 代理。之后,我告诉 npm 使用该代理:
npm config set proxy http://127.0.0.1:8001
npm config set https-proxy http://127.0.0.1:8001

