跳至主要内容

Squid2.6与2.5比较

Ubuntu环境下:
$ sudo apt-get install squid
$ sudo vim /etc/squid/squid.conf

#2.6下基础配置中
http_port 3128 transparent
cache_men cache_dir (根据目标的代理服务器进行配置)
dns_nameservers 202.101.172.35 202.101.172.46 202.101.172.47
auth_param 相对进行开放,children 5
realm Squid proxy-caching web server
casesensitive off
#acl 配置
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443 # https
acl SSL_ports port 563 # snews
acl SSL_ports port 873 # rsync
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl Safe_ports port 631 # cups
acl Safe_ports port 873 # rsync
acl Safe_ports port 901 # SWAT
acl purge method PURGE
acl CONNECT method CONNECT
acl denydomain dstdomain -i "/etc/squid/denydomain"
acl allowsrcip src "/etc/squid/allowsrcip"
acl denyurlregex url_regex -i "/etc/squid/denyurlregex"
acl time1 time SMTWHFA 0:00-23:59
acl conn1 maxconn 60
acl file1 urlpath_regex -i \.mp3$ \.exe$ \.zip$ \.rar$ \.torrent$ \.avi$ \.rmvb$ \.wma$ \.com$ \.mpg$ \.rm$ \.scr$ \.ocx$ \.cab$

#http_access deny/allow
http_access deny denydomain
http_access deny !allowsrcip
http_access deny file1
http_access deny denyurlregex
http_access deny allowsrcip !time1
http_access deny allowsrcip conn1
http_access allow localhost
http_access allow allowsrcip
http_access deny all

denydomain dengyurlregex allowsrcip 进行配置


#2.5的反向代理加速配置
#httpd_accel_host 127.0.0.1
#httpd_accel_port 80
#httpd_accel_single_host on
#httpd_accel_uses_host_header on
#httpd_accel_with_proxy on

总体来说整个SQUID在版本升级以后变的更为简单,但是一开始并不是十分适应,我大概用了将近一个礼拜也没有讲透明代理的效果设置出来,根据前面设置的IPTABLES相互配合,两者可以相辅相成,对于两者来说需要怎么样使用都可以来看。
在经理的调试下,终于成功。

评论

此博客中的热门博文

4 steps to delete account in Gerrit DB

4 steps to delete account in DB. Delete from accounts where preferred_email=’’; delete from account_ssh_keys where account_id=''; delete from account_external_ids where external_id='gerrit:*’; delete from account_external_ids where external_id='username:*’; whatever it was in H2 database and postgres db . H2: ssh -p 24198 localhost gerrit gsql Postgres: psql

mod

apache安装后,如果想再添加模块,往往不想重新安装一次,再者,我在安装中发现,并不是安装文件中所有的modules都会被默认安装,即使在安装中使用了 ./configure --prefix=/usr/local/apache --enable-so --enable-modules=all --enable-mods-shared=all也是如此。我使用上述方法安装的apache2.2.6就没有安装proxy相关模块。这时,需要手工生成so文件,但会自动的被复制到你的apache安装目录的modules中,然后修改apache的配置文件,加载相关模块,验证apache配置并重启服务即可。以上描述的具体操作步骤如下: 操作系统:linux redhat 4.5 ES apache版本:2.2.6 可自行下载tar包 1. 拷贝安装包到/usr/local,并在目标目录下进行解压。[root@localhost local]# cd /usr/local[root@localhost local]# tar -zxvf httpd-2.2.4.tar.gz2. 配置安装参数,安装的目标目录为/usr/local/apache,建议设置enable-mods-shared=all,不用的module注释掉就行了![root@localhost local]# cd httpd-2.2.4[root@localhost httpd-2.2.4]# ./configure --prefix=/usr/local/apache --enable-so --enable-mods-shared=all3. 编译并安装。[root@localhost httpd-2.2.4]# make[root@localhost httpd-2.2.4]# make install4. 启动Apache,并测试。[root@localhost httpd-2.2.4]# cd /usr/local/apache/bin[root@localhost bin]# ./apachectl start 打开浏览器,并在地址栏中输入主机的IP地址如 http://192.168.1.254/ 如果出现以下画面则说明安装成功。It works! 注意:安装完成后检查系统服务中的HTTPD服务是否已