最近我的网站开始在每个页面上使用过多的加载时间。在第一个 GET 请求之后,我得到了以下信息:
"receive" : 2,
"dns" : 15,
"send" : 0,
"ssl" : 100,
"wait" : 6005,
"blocked" : 1,
"connect" : 142
我怀疑这与 SSL 证书 (Let's Encrypt) 有关,因为我的相同子域名http://stage.example.com
没有出现这种情况。在阶段网站上,等待时间约为 1 秒。
我的文件中有这个内容.htaccess
用于将用户重定向到 https:
RewriteEngine on
RewriteCond %{HTTPS} !=on
# This checks to make sure the connection is not already HTTPS
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
# This rule will redirect users from their original location, to the same location but using HTTPS.
# i.e. http://www.example.com/foo/ to https://www.example.com/foo/
# The leading slash is made optional so that this will work either in httpd.conf
# or .htaccess context
# Set "protossl" to "s" if we were accessed via https://. This is used later
# if you enable "www." stripping or enforcement, in order to ensure that
# you don't bounce between http and https.
RewriteRule ^ - [E=protossl]
RewriteCond %{HTTPS} on
RewriteRule ^ - [E=protossl:s]
谁能想到我的生产站点加载时间这么长可能的原因?
已编辑:抱歉,重定向规则不完整,上面的代码是我使用的。此外,当直接在根目录中访问 phpinfo.php 文件时,几乎没有任何等待时间(<50 毫秒)。