【发布时间】:2016-02-14 05:56:24
【问题描述】:
为了加快 MediaWiki 站点的速度,该站点的内容使用大量模板,但在模板完成工作后几乎具有静态内容,我想设置一个 squid 服务器 见
https://www.mediawiki.org/wiki/Manual:PurgeList.php
和
https://www.mediawiki.org/wiki/Manual:Squid_caching
然后使用脚本执行 wget/curl 调用来“自动”填充 squid 服务器的缓存,该脚本会访问 Mediawiki 的所有页面。我的预期是,在这个过程之后,每个页面都在 squid 缓存中(如果我把它做得足够大的话),然后每次访问都将由 squid 完成。
我怎样才能让它发挥作用? 例如:
- 如何检查我的配置?
- 如何知道需要多少内存?
- 如何检查页面是否在 squid3 缓存中?
到目前为止我尝试了什么
我开始了解如何使用以下方法安装 squid:
和
我查到了我的ip地址xx.xxx.xxx.xxx(这里不公开) 通过 ifconfig eth0
在 /etc/squid3/squid.conf 我放了
http port xx.xxx.xxx.xxx:80 transparent vhost defaultsite=XXXXXX
cache_peer 127.0.0.1 parent 80 3130 originserver
acl manager proto cache_object
acl localhost src 127.0.0.1/32
# Allow access to the web ports
acl web_ports port 80
http_access allow web_ports
# Allow cachemgr access from localhost only for maintenance purposes
http_access allow manager localhost
http_access deny manager
# Allow cache purge requests from MediaWiki/localhost only
acl purge method PURGE
http_access allow purge localhost
http_access deny purge
# And finally deny all other access to this proxy
http_access deny all
然后我配置了我的 apache2 服务器
# /etc/apache2/sites-enabled/000-default.conf
Listen 127.0.0.1:80
我加了
$wgUseSquid = true;
$wgSquidServers = array('xx.xxx.xxx.xxx');
$wgSquidServersNoPurge = array('127.0.0.1');
到我的 LocalSettings.php
然后我重新启动 apache2 并使用 squid3 启动
service squid3 restart
并进行了第一次访问尝试
wget --cache=off -r http://XXXXXX/mediawiki
结果是:
Resolving XXXXXXX (XXXXXXX)... xx.xxx.xxx.xxx
Connecting to XXXXXXX (XXXXXXX|xx.xxx.xx.xxx|:80... failed: Connection refused.
【问题讨论】:
标签: apache caching mediawiki squid