【发布时间】:2014-06-10 01:02:14
【问题描述】:
我想压缩我们的网站 www.urbanlocker.co.uk 以加快页面加载速度。我不知道它是 apache web 服务器、lingx 还是如何找出它是哪一个。顺便说一句,我可以访问 filezilla 来上传/下载文件,但不能访问托管公司。我正在复制粘贴这些代码,以便启用 gzipping 并将 .htaccess 文件上传到根文件夹,但没有任何效果。有谁知道我在哪里做错了?
这个是Apache推荐的:
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
另一个:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
这个是推荐给nginx的:
gzip on;
gzip_comp_level 2;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# Disable for IE < 6 because there are some known problems
gzip_disable "MSIE [1-6].(?!.*SV1)";
# Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6
gzip_vary on;
如果您需要更多信息,请告诉我。提前非常感谢。
【问题讨论】:
-
从 HTTP 标头来看,它是 IIS / ASP.NET,它已经被 gzip 压缩了。
-
Builtwith 是你的朋友:builtwith.com/?q=www.urbanlocker.co.uk
-
@TanHongTat 非常感谢!
-
@jeffatrackaid 谢谢!
标签: apache .htaccess nginx gzip