Javascript 如何将GZIP压缩添加到我的项目(托管在aws上,运行apache服务器)
我正在尝试gzip从我的应用程序返回的数据 我正在使用 服务器版本:Apache/2.2.31(Unix) 架构:64位 首先,我遵循这里的说明Javascript 如何将GZIP压缩添加到我的项目(托管在aws上,运行apache服务器),javascript,apache,amazon-web-services,gzip,httpd.conf,Javascript,Apache,Amazon Web Services,Gzip,Httpd.conf,我正在尝试gzip从我的应用程序返回的数据 我正在使用 服务器版本:Apache/2.2.31(Unix) 架构:64位 首先,我遵循这里的说明 .htaccess <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-
.htaccess
<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>
然后我要确保测试正确。我将我的网站的url粘贴到这样的网站上
我发现我的网站没有被压缩 然后我使用Chrome开发工具视图(最后一个请求行)查看大小和内容是否不相同 看起来内容和大小不一样? 它被剪掉了吗 问题:
httpd.conf
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
# Despite the name similarity, the following Add* directives have nothing
# to do with the FancyIndexing customization directives above.
#
AddEncoding x-compress .Z
AddEncoding x-gzip .gz .tgz
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz