如何为icdsoft开启gzip压缩 提升网站访问速度

admin 懒人文摘1 字数 2143阅读模式

如何为icdsoft开启gzip压缩 提升网站访问速度

鲜活优惠码之前购买了icdsoft的香港主机(目前鲜活并不存放于icdsoft),速度挺快的,国内ping值平均都在50左右!访问速度也非常快,但是没有人会嫌弃网站访问速度太快吧,icdsoft采用的是自己的面板,所以开启gzip的方案也和其他主机有些不同,有些主机可以直接在后台开启,目前icdsoft后台并不提供这个功能,不过,我们可以在自己网站的.htaccess文件里,添加一段代码即可!(如果你的网站更目录还没有.htaccess文件,就自己上传一个呗)

现在网上介绍的icdsoft空间开启gzip压缩的方法基本是不可用的,根据查阅官方帮助文档,加上亲测,现共享开启gzip压缩方法。
先解释为什么网上流行的一长串代码方法无效,官方解释是:icdsoft使用的是Apache 2,而mod_gzip是适用于Apache 1.3;在Apache 2环境下,mod_gzip包含在mod_deflate module中。原文:Mod_gzip is a module for the Apache 1.3 Web Server. As we do not use Apache 1.3 on our servers, it is not available with our service. We are using Apache 2. In Apache 2, the functionality of mod_gzip is covered by the mod_deflate module.
       开启mod_deflate的方法:在根目录下的.htaccess(没有就创建一个)添加如下代码即可

<IfModule deflate_module>
AddOutputFilterByType DEFLATE text/css text/csv text/html text/plain text/richtext text/sgml text/tab-separated-values application/javascript application/x-javascript httpd/unix-directory
AddOutputFilter DEFLATE html htm shtml php php4 pl rb py cgi css js txt
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>

失效的icdsoft gzip压缩代码:

<ifmodule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_keep_workfiles No
mod_gzip_can_negotiate Yes
mod_gzip_add_header_count Yes
mod_gzip_send_vary Yes
mod_gzip_command_version '/mod_gzip_status'
mod_gzip_min_http 1000
mod_gzip_minimum_file_size 300
mod_gzip_maximum_file_size 512000
mod_gzip_maximum_inmem_size 60000
mod_gzip_handle_methods GET POST
mod_gzip_temp_dir /tmp
mod_gzip_item_include file \.html$
mod_gzip_item_include file \.php$
mod_gzip_item_include file \.pl$
mod_gzip_item_include file \.rb$
mod_gzip_item_include file \.py$
mod_gzip_item_include file \.cgi$
mod_gzip_item_include file \.css$
mod_gzip_item_include file \.js$
mod_gzip_item_include mime ^application/javascript$
mod_gzip_item_include mime ^application/x-javascript$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^httpd/unix-directory$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include handler ^server-status$
mod_gzip_item_include handler ^server-info$
mod_gzip_item_include handler ^application/x-httpd-php
mod_gzip_item_exclude mime ^image/.*
</ifmodule>
如何为icdsoft开启gzip压缩 提升网站访问速度

以上是如何为icdsoft开启gzip压缩 提升网站访问速度全文   icdsoft 优惠码 

 
admin
  • 本文由 admin 发表于 2015年4月27日 14:45:37
    • 奇遇
      奇遇 0

      icdsoft还是不错的 可惜香港节点贵了点

    评论已关闭!