我使用Apache 2.4.18作为Java Web应用程序的反向代理。
我需要在Html和Javascript文件上配置gzip-compression。
我已经激活了deflate,标题和过滤器模块(当然还有mod_jk)。
我的apache2.conf文件是我添加的默认配置文件:
Include sites-enabled/
JKWorkersFile /etc/apache2/workers.properties
ServerName localhost
我的网站启用/ example.com反向代理我的应用程序,如下所示:
<VirtualHost *:443>
ServerName gzip.example.com
SSLEngine on
JKMount /application* 172_10_0_1;use_server_errors=400,500
ErrorLog /var/log/apache2/gzip.example.com-error.log
LogLevel warn
CustomLog /var/log/apache2/gzip.example.com-access.log combined
SSLCertificateFile /etc/ssl/private/*.example.com.pem
SSLCertificateChainFile /etc/ssl/private/chain_example.com.crt
</VirtualHost>
我正在使用mods-enabled / deflate.conf:
<IfModule mod_deflate.c>
<IfModule mod_filter.c>
# these are known to be safe with MSIE 6
AddOutputFilterByType DEFLATE text/html text/plain text/xml
# everything else may cause problems with MSIE 6
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/xml
</IfModule>
</IfModule>
我的浏览器在js文件上说(也请查看Google Pagespeed):
Response Headers
Accept-Ranges:bytes
Cache-Control:max-age=0, no-cache, must-revalidate
Connection:Keep-Alive
Content-Length:15292
Content-Type:text/javascript
Date:Fri, 22 Jan 2016 16:21:05 GMT
ETag:W/"15292-1440752026000"
Expires:Thu, 01 Jan 1970 00:00:00 GMT
Keep-Alive:timeout=5, max=99
Last-Modified:Fri, 28 Aug 2015 08:53:46 GMT
Pragma:No-cache
Server:Apache/2.4.18 (Ubuntu) mod_jk/1.2.37 OpenSSL/1.0.2e
Strict-Transport-Security:max-age=31536000 ; includeSubDomains
X-Frame-Options:SAMEORIGIN
我错过了配置吗?