1

我无意中运行了一个现在取得了很大成功的 Wordpress 网站。该网站变得非常缓慢,所以我决定对其进行调整:

  • 我最近从 Apache 更改为 Lighttpd
  • 我的静态图片,js 和 css 都是通过 Edgecast 运行的
  • Cloudflare 正在管理我的 DNS

即使使用这种新设置,该站点也确实很慢(我的意思是页面在十秒内加载)。有时,该网站甚至没有回答。我仍在试图找出原因,所以我从 Lighttpd 激活了 stat 模块。据我所知,大部分请求都进入了首页。它们都来自 Cloudflare。我的问题是:我认为 Cloudflare 正在缓存页面。为什么它仍然在一秒钟内多次询问首页?

由于我没有更多的想法来加快网站速度,如果您有任何提示,我也在寻找提示。我认为,大部分缓慢是由 Wordpress 和我拥有的所有插件引起的。

任何帮助,将不胜感激。

4

3 回答 3

2

If CloudFlare is turned on on that domain, all requests will go through CloudFlare. This means that your server will only see CloudFlare's IPs and all requests will look like it is coming from them.

To solve this, there are modules from CloudFlare available, but I don't believe there is one compatible with Lighttpd. But, there is a CloudFlare plugin for WordPress that will do the same thing.

CloudFlare does not cache HTML (except for the "Always On" feature). Does use it to cache pages because it does not cache pages. It caches static resources like images, js, and css.

Because of this, you still need a page caching plugin. If you want something full featured, then go for W3TC. If you want something simpler, go for HyperCache.

于 2011-09-03T20:15:30.513 回答
2

无法直接与 Cloudflare 对话,但您始终可以安装其中一个 WordPress 缓存插件。

我推荐Hyper Cache。它重量轻,配置简单。如果您需要,其他人会提供更多牛肉。

于 2011-09-01T20:30:28.070 回答
0

CloudFlare 处理静态资源(图像/CSS/JS)与动态内容(HTML/PHP)不同。在静态资源的情况下,您可以使用 HTTP 标头来控制 CDN 缓存。对于动态内容,您的 HTTP 标头不会对 CDN 产生任何影响。标头仅转发给最终用户。

CloudFlare 的“页面规则”可用于覆盖此行为和“缓存所有内容”。人们可能期望此功能能够为动态内容启用 HTTP 标头控件,但标头仍然被忽略。相反,始终使用 Page Rule 的“Edge TTL”设置。在免费的 CloudFlare 帐户上,最短 CDN 缓存时间为 2 小时。

请注意有条件的内容 - 例如管理页面、用户帐户菜单和付费内容,在某些情况下,这些内容可能会被缓存并在 CloudFlare 上免费访问。

网站通常受益于服务器端缓存,无论是否有 CDN。数据库查询缓存和组件缓存等功能有助于减少呈现页面所需的工作,通常会提高性能。

于 2016-06-14T14:52:16.953 回答