Garey's Blog–FreeBSD/PHP/GoLang

十一月 21st, 2012

FreeBSD下简易Http代理服务器安装笔记(Squid)

7,334 views, FreeBSD, by garey.

FreeBSD下简易Http代理服务器安装笔记(Squid)

一、更新ports
# csup -L 2 -h cvsup.freebsdchina.org /usr/share/examples/cvsup/ports-supfile

二、安装Squid
# cd /usr/ports/www/squid
# make install clean

三、生成密码文件
# htpasswd -c /usr/local/etc/squid/password username
输入两次密码即可生成密码文件

四、配置
# vi /usr/local/etc/squid/squid.conf

http_port 3128
cache_dir null /var/squid/cache/
cache_access_log /var/squid/logs/access.log
cache_log /var/squid/logs/cache.log
cache_store_log /var/squid/logs/store.log

acl all src 0.0.0.0/0

auth_param basic program /usr/local/libexec/squid/ncsa_auth /usr/local/etc/squid/password
auth_param basic children 5
auth_param basic credentialsttl 2 hours
auth_param basic realm bsdart.org
acl auth_user proxy_auth REQUIRED
http_access allow auth_user

五、建立缓存
# /usr/local/sbin/squid -z

六、启动服务
# vi /etc/rc.conf

squid_enable=”YES”

# /usr/local/etc/rc.d/squid start

Back Top

发表评论