给Openwrt安装polipo

本文介绍了如何在Openwrt 14.07 x86平台上安装和配置polipo,它是一个轻量级的HTTP代理服务器,具备缓存功能。文章提到了通过命令行或LUCI界面安装,以及配置文件的修改,同时指出openwrt 14.07中的polipo磁盘缓存问题和日志无时间戳的不便。用户可以通过修改配置文件设置上级SOCKS代理,并链接到官方手册获取更多详细信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

polipo是一款小巧的带缓存机制的http代理服务器,可以运行于linux与windows,支持二级代理,支持简单的身份认证,很适合在openwrt上配合autossh实现科学上网。

环境:Openwrt 14.07 x86平台。

第一步,安装软件

opkg install polipo

如果喜欢用图形界面的话,也可以安装luci的polipo设置模块:

opkg install luci-app-polipo


第二步,修改配置,编辑文件/etc/config/polipo,内容如下:

# polipo daemon configuration
config 'polipo' 'daemon'
        # daemonise polipo (fork in background)
        option 'daemonise' '1'
        # where polipo will store its process pid
        option 'pidFile' '/var/run/polipo.pid'
        option 'socksParentProxy' '127.0.0.1:1080'
        option 'authCredentials' 'username:password'

config 'polipo' 'general'
        option 'enabled' '1'
        # adress on which polipo will listen, 0.0.0.0 means all addresses
        option 'proxyAddress' '0.0.0.0'
        # port on which polipo will listen, default is 8123
        option 'proxyPort' '8080'
        # list of allowed clients to connect
        list 'allowedClients' '0.0.0.0/0'
        list 'allowedClients' '127.0.0.1'
        #list 'allowedClients' '192.168.2.1'
        # how much RAM memory should Polipo use (in bytes).
        option 'chunkHighMark' '104857600'
        # enable disk cache index and serverlist of integrated polipo web interf
        #option 'disableIndexing' '0'
        #option 'disableServersList' '0'
        # disable loging to syslog
        option 'logSyslog' '0'
        # set log file location (disabled when not set)
        option 'logFile' '/root/polipo/log'

config 'polipo' 'cache'
        # disk cache location, you should always use external storage device
        # (disabled when not set)
        option 'diskCacheRoot' '/root/polipo/cache'
        # disk cache cleanup settings
        #option 'diskCacheUnlinkTime' '20d'
        #option 'diskCacheTruncateTime' '5d'
        #option 'diskCacheTruncateSize' '3145728'
        # set to 1 if proxy is used by multiple users
        #option 'cacheIsShared' '1'

config 'polipo' 'pmm'
        # poor man's multiplexing semgnet size to fetch
        #option 'pmmSize' '8192'


第三步,启动polipo

/etc/init.d/polipo start

完成!


需要说明的是:

1. openwrt 14.07上的polipo好像有个bug,那就是在设置了diskCacheRoot参数后,polipo不能启用磁盘缓存,原因未明。

2. luci的设置界面中,不能设置socks类型的上级代理,所以只能通过修改配置文件实现

3. 有关polipo的说明在:http://www.pps.univ-paris-diderot.fr/~jch/software/polipo/manual/ 

4. polipo的日志文件中没有时间戳,这一点对于问题分析很头疼,日志等级的设置。

5. openwrt上polipo配置文件的生成由/etc/init.d/polipo脚本完成,该脚本首先读取/etc/config/polipo,读取其中的配置,然后将其按照polipo所定义的配置文件的格式,在/var/etc/上输出临时配置文件polipo.conf,然后使用该配置文件启动polipo。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值