赞助连接

赞助连接

阅 读 文 章

squid代理本机apache的教程!!

[来源:网上转载 (http://bbs.chinaunix.net) | 作者:网友(linuxnextyear) | 时间:2007-11-17 | 浏览: 人次 ]

开始学习squid服务器,动手实现了一个简单的功能!即:在一台机器上安装squid和apache服务,实现squid对本机的apache服务实现加速功能,系统是:linuxAS4 + apache + squid ,送给和我一样的新手!

说明:服务器只有一块网卡,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

最新评论 共有0位网友发表了评论

发表评论

评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名:(注册)
密码:
验证码:
匿名发表
网站地图友情连接交流论坛网站投稿广告服务联系我们留言本站长统计
Some rights reserved: www.newhtm.com, 鄂ICP备07010232号 E-mail:chinakafei@live.com,QQ:552766
中国咖啡技术网(Chmhome):国外编程技术书籍,中文编程手册,经典编程文章,交流技术,技术软件下载,计算机论文,毕业论文.