Blog信息 |
blog名称: 日志总数:1304 评论数量:2242 留言数量:5 访问次数:7593801 建立时间:2006年5月29日 |

| |
[网站架构]用squid加速apache 软件技术
lhwork 发表于 2007/1/21 15:01:27 |
早就看过用squid加速apache的文章,就是懒的去玩,今天闲来郁闷,突然想玩玩,所以就有了本文(本文不算是原创,都是建立他人的基础上凑起来的,算是整理吧!)系统:redhat as 4apache :httpd-2.0.52-9.entsquid :squid-2.5.STABLE6-3.4E.31.安装安装squid很简单:# yum -y install squid配置squid修改:/etc/squid/squid.conf成下面的http_port 80icp_port 0acl QUERY urlpath_regex cgi-binno_cache deny QUERYcache_mem 16 MBcache_dir ufs /tmp 256 16 256log_icp_queries offbuffered_logs onemulate_httpd_log onredirect_rewrites_host_header offhalf_closed_clients offacl all src 0.0.0.0/0.0.0.0http_access allow allcache_mgr admincache_effective_user squidcache_effective_group squidhttpd_accel_host virtualhttpd_accel_uses_host_header onhttpd_accel_port 81这里解释一下http_port”参数指定Squid监听浏览器客户请求的端口号,这里当然是80了cache_dir ufs /tmp 256 16 256cache_dir参数设定使用的存储系统的类型。一般情况下都类型应该是ufs,目录应该是“/tmp”,在该目录下使用的缓冲值为256MB,允许在“/tmp”下创建的第一级子目录数为16,每个第一级子目录下可以创建的第二级子目录数量为256选项“httpd_accel_host”和“httpd_accel_port”定义了真正的Web服务器的主机名和端口号。在这里的配置中,真正的HTTP服务器运行的状况是虚拟主机:virtual而运行的端口是:81。选项“httpd_accel_uses_host_header”是什么意思就不清楚了,还没看说明3.修改apache的配置文档这里就不说apache的安装了!注意3个地方:(1)Port 80这里改成:Port 81(2)NameVirtualHost 221.6.145.41:81如何没有这句,就加上这句!(3)虚拟主机:<VirtualHost 221.6.145.41:81> ServerAdmin webmaster@ourlinux.net DocumentRoot /var/www/yum.ourlinux.net ServerName apt.ourlinux.net ErrorLog logs/yum.ourlinux.net-error_log CustomLog logs/yum.ourlinux.net-access_log common</VirtualHost><VirtualHost 221.6.145.41:81> ServerAdmin webmaster@ourlinux.net DocumentRoot /var/www/apt.ourlinux.net ServerName apt.ourlinux.net ErrorLog logs/yum.ourlinux.net-error_log CustomLog logs/yum.ourlinux.net-access_log common</VirtualHost>ip部分要一致!4.启动!先启动httpd再启动squid |
|
|