快速业务通道

RHCE253--架设Squid服务器

作者 佚名技术 来源 Linux系统 浏览 发布时间 2012-04-13
(周日~周六) # S - Sunday # M - Monday # T - Tuesday # W - Wednesday # H - Thursday # F - Friday # A - Saturday //S被周日用了,就用第二个字母 eg1: acl time1 time MTWHF 09:00-12:00 14:00-17:30 acl time2 time MTWHF 08:00-18:00 acl boss src 192.168.101.112 http_access allow boss time2 http_access deny time1 acl aclname url_regex [-i] ^http:// 限制访问协议,网址 eg2: 不允许ftp,rstp,mms acl ftp_test url_regex -i ^ftp:// acl rstp_test url_regex -i ^rstp:// acl mms_test url_regex -i ^mms:// acl url_test url_regex -i fake yellow acl aclname urlpath_regex [-i] .gif$ 限制下载,文件扩展名 eg3: acl download urlpath_regex -i .torrent$ .exe$ .com$ .zip$ .rar$ .tar$ .gz$ http_access deny download acl aclname urllogin [-i] [^a-zA-Z0-9] 限制网址登录 acl aclname port 80 70 21 限制端口 eg4: 禁止QQ acl qq port 4000 8000 acl aclname proto HTTP FTP 限制协议 acl aclname method GET POST 限制方法 acl aclname proxy_auth [-i] username ... 身份认证 acl aclname proxy_auth_regex [-i] pattern 身份认证,支持正则表达式 acl aclname maxconn number 限制用户最大连接数 eg5: 限制连接 acl conn1 maxconn 2 注意:若没有做过调整,默认的squid.conf文件中将会拒绝其他客户机使用代理服务, 即存在“http_access deny all” 实例: 允许员工的周一~周五,12:00~14:00 15:00~18:00上网 允许webmin端口 允许tomcat端口 禁止下载.gz .tar .bz2的文件 vim /etc/squid/squid.conf acl mynet src 192.168.101.0/24 acl time1 time MTHWFA 07:00-14:00 15:00-18:00 acl Safe_ports port 10000 acl Safe_ports port 8080 acl download urlpath_regex -i .gz$ .tar$ .bz2$ http_access deny download mynet http_access allow mynet time1 http_access deny all service squid reload service httpd start cd /var/www/html/ touch 1.tar 2.gz 3.bz2 通过在Windows用浏览器下载可以发现被拒绝! 六、搭建透明代理网关服务器 1、实现透明代理的基本条件 (1)前提: 客户机的Web访问数据要能经过防火墙 代理服务构建在网关(防火墙)主机中 (2)配置要求: 代理服务程序能够支持透明代理 设置防火墙规则,将客户机的Web访问数据自动重定向给代理服务程序处理 基本实现步骤 修改squid.conf配置文件,并重新加载该配置 http_port 192.168.1.1:3128 transparent 添加iptables规则 iptables -t nat -I PREROUTING -i eth1 -s 192.168.1.0/24 -p tcp --dport 80 -j REDIRECT --to-ports 3128 客户机浏览器 不需要在浏览器中指定代理服务器的地址、端口 七、搭建反向代理服务器 1、基本实现步骤 修改squid.conf文件,并重新加载该配置 http_port 218.29.30.31:80 vhost cache_peer 192.168.2.11 parent 80 0 originserver weight=5

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号