Nginx 响应静态文件时间过长

Nginx responses static files for too long time

出于某些意外原因,我的 nginx 服务器响应静态文件(如 .css.js)的时间过长。例如,页面上有一些连接的脚本和样式表,文件大小小于 10kb。 Chrome devtools 时间线分析显示,这些文件的下载时间约为 15 秒以上(请参见下面的屏幕截图)。

这么长时间响应静态文件可能是什么原因?

Important update. I noticed, that it happens only on html pages. If to open any js or css file singulary, it loads fastly, as it's actually expected.

我在我的服务器上使用nginx+apache bundle,nginx负责所有的静态文件,比如js,css,图片等等。

提前致谢。

我的问题是由 DDoS-protection (ngx_http_limit_req_module) 配置不正确引起的。我无意中 copy-pasted nginx 配置从互联网的某个地方到我的服务器(所以,一切正常,除了页面加载时间)。谢谢上帝,我有一点要检查 nginx 错误日志,其中有像

这样的警告

2017/01/12 04:14:33 [warn] 21347#21347: *120 delaying request, excess: 0.975, by zone "my_host", client: my_ip_address, server: my_host, request: "GET JS_OR_CSS_SCRIPT_URI HTTP/1.1", host: "my_host", referrer: "page_url_which_was_requesting_js_or_css"

因此,谷歌搜索有助于正确配置 limit_req_zonelimit_req

http {
     limit_req_zone $host zone=hostreqlimit:20m rate=1500r/m;
     ...
     server {
               ...
               limit_req zone=hostreqlimit burst=2500 nodelay;
               ...
     }
}

抱歉问了一个愚蠢的问题 c: