您的位置:首页 > 运维架构 > 反向代理

Squid 安装配置

2008-07-10 18:15 417 查看
安装系统 Linux ENT AS 4 2.6.9-5.ELsmp
安装软件是系统自带的 squid-2.5.STABLE6-3.i386
我的系统带2块网卡。一个外网地址。一个内网地址。防火墙配置可以让网内机器上网。
安装完成后,进入配置:
我只进行了简单配置,并且测试成功。
配置文件的位置在 /etc/squid/
[root@localhost squid]# vi squid.conf
以下是我的配置,具体说明配置文档里都有。以下是我所开启的配置,其中有些项是已经开启的:
http_port 192.168.1.205:3128 内网网关地址
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
cache_mem 40 MB
cache_swap_low 90
cache_swap_high 95
maximum_object_size 4096 KB
cache_dir ufs /var/spool/squid 100 16 256
cache_access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log
mime_table /etc/squid/mime.conf
pid_filename /var/run/squid.pid
debug_options ALL,1
client_netmask 255.255.255.255
auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
acl advance src 192.168.1.1-192.168.1.10/32
acl normal src 192.168.1.11-192.168.1.200/32
acl baduser src 192.168.1.226/32
acl all src 0.0.0.0/0
http_access deny baduser
http_access allow advance
http_access allow normal
http_access allow all
http_reply_access allow all
icp_access allow all
cache_mgr 你的邮件地址
cache_effective_user squid
cache_effective_group squid
visible_hostname No1.proxy
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
dns_testnames netscape.com internic.net nlanr.net microsoft.com
error_directory /etc/squid/errors
coredump_dir /var/spool/squid
具体我就做了这些。
然后设置iptables 防火墙,加入;
iptables -t nat -A PREROUTING -s 192.168.1.225/32 -p tcp --dport 80 -j REDIRECT –to-ports 3128
然后启动squid
[root@localhost ~]# /usr/sbin/squid -f /etc/squid/squid.conf -a 3128
接下来可以查看日志:
如果有错误,可以查看squid.out文件。
然后你可以通过ip为 192.168.1.225 上网。如果可以上网。你就可以在/var/log/squid/access.log文件里看到你所访问的内容。证明squid成功。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: