【发布时间】:2017-12-26 17:24:53
【问题描述】:
我正在尝试优化我的网站的渲染速度。
但是 Nginx 不提供 rel="preload" 的 css 链接, 当它是 rel="stylesheet" 时,它工作正常。
<link href="css/fontawesome.css" rel="preload" onload="clearRel()" as="style"/>
我安装了一个新的 nginx 版本 1.13.7,这是我安装的模块:
nginx version: nginx/1.13.7
built by gcc 4.9.2 (Debian 4.9.2-10)
built with OpenSSL 1.0.2l 25 May 2017
TLS SNI support enabled
configure arguments: --add-module=/root/ngx_pagespeed-latest-stable
--with-compat
--with-file-aio
--with-threads
--with-http_addition_module
--with-http_auth_request_module
--with-http_dav_module
--with-http_flv_module
--with-http_gunzip_module
--with-http_gzip_static_module
--with-http_mp4_module
--with-http_random_index_module
--with-http_realip_module
--with-http_slice_module
--with-http_ssl_module
--with-http_sub_module
--with-http_stub_status_module
--with-http_v2_module
--with-http_secure_link_module
--with-mail
--with-mail_ssl_module
--with-stream
--with-stream_realip_module
--with-stream_ssl_module
--with-stream_ssl_preread_module
--with-debug
--with-cc-opt='-g
-O2
-fPIE
-fstack-protector-strong
-Wformat
-Werror=format-security
-Wdate-time
-D_FORTIFY_SOURCE=2'
--with-ld-opt='-Wl,-Bsymbolic-functions
-fPIE
-pie
-Wl,-z,relro
-Wl,-z,now'
当它在 rel="preload" 时,我没有匹配的 css 文件日志。
你能不能帮帮我。
非常感谢您。
【问题讨论】:
-
两件事,检查您的浏览器是否正在发出请求。还要检查你在 nginx 访问日志中得到了什么
-
感谢您的回答,但是浏览器没有请求,也没有访问日志,我备份了我的虚拟机,它与旧的nginx完美配合
-
看到问题出在浏览器端,它没有发出请求,而不是 nginx 上的服务器端
标签: css nginx rel stylesheet-link-tag