说明:服务器只有一块网卡,125.35.xxx.xxx,在公网上做了dns解析,把www1.mydomain 和 www2.mydomain都解析到了这个
公网地址125.35.xxx.xxx!
1)安装apache并配置两个虚拟主机
httpd.conf的几个修改
Listen 127.0.0.1:80(使用本地地址)
apache绑了2个虚机:地址都是127.0.0.1:80
附上一个配置文件:
<VirtualHost 127.0.0.1:80>
DocumentRoot /opt/webdata/www1cn
ServerName www1.mydomain
DirectoryIndex index.html
</VirtualHost>
然后修改/etc/hosts文件把127.0.0.1这行变成一下形式:
127.0.0.1 www1.mydomain www2.mydomain localhost localhost.localdomain
apache不多说了,配置完了然后启动!
2)安装squid并配置
下载squid-2.6.STABLE16.tar.gz到/tmp目录下
# cd /tmp
# wget http://www.squid-cache.org/Versi ... 2.6.STABLE16.tar.gz
# tar zvxf squid-2.6.STABLE16.tar.gz
# cd squid-2.6.STABLE16
# ./configure --prefix=/opt/squid --with-maxfd=65536 ; make;make install;echo $?
//最后看到0就表示安装正常结束
# cd /opt/squid
把etc/squid.conf变为以下内容:
visible_hostname 229squid
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
acl Safe_ports port 80
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow all
icp_access allow all
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY
access_log /opt/squid/var/logs/access.log squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
-
TAG标签 : 教程 代理 acl apache squid http_access www1.mydomain
会员注册
会员登录
个人空间
发表评论