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

magento -- 尝试使用squid来缓存html页面来提升magento网站的速度

2010-06-02 12:14 549 查看
使用squid代理服务器可以缓存服务器上经常请求页面的HTML代码.如果把它作为反射代理,可以提高网站的访问速度.在网上搜索了很多资料,打算一一做个试验:

安装squid.

yum install squid (on redhat machine)

#configured apache server to serve magento site on port 81 instead of 80

配置apache侦听81端口,因为当我们配置好之后,apache并不对外直接提供浏览服务,而是由squid来提供.所以下面我们要设置squid侦听80端口,来接受传过来的请求.

#now configured squid to serve on port 80
# under /etc/squid/squid.conf, added following lines above http_access settings
http_port 80 accel defaultsite=www.sitename.com
cache_peer 1.1.1.1 parent 81 0 no-query originserver name=myAccel
acl our_sites dstdomain www.sitename.com
http_access allow our_sites



#if you want to allow only .html to be cached, un-comment below lines
#acl HTML url_regex .html$
#cache allow HTML
#cache deny all

# to remove caching on checkout page, add wishlist page in case if it doesnt need caching


如果只想允许对.html页面进行缓存,把下面的这几行注释去掉

去除动态页面的缓存,比如支付页面,肯定是不能缓存的了.
acl CHECKOUT url_regex ^http://www.sitename.com/checkout$
cache deny CHECKOUT

cache_peer_access myAccel allow our_sites
cache_peer_access myAccel deny all

#save and restart squid and httpd

...........

参考:

http://www.magentocommerce.com/group/blog/action/viewpost/1080/group/168
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: