mod_deflate和Pagespeed

我在我的服务器上激活了mod_deflate。 问题是,谷歌pagespeed说,我的网站需要压缩

有没有人有个想法?

这段代码位于/etc/apache2/apache2.conf。 我重新启动apache。

<IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/plain text/html text/xml AddOutputFilterByType DEFLATE text/css text/javascript AddOutputFilterByType DEFLATE text/js text/javascript AddOutputFilterByType DEFLATE application/xml application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/javascript application/x- javascript </IfModule> 

你忘了configuration输出filter

 SetOutputFilter DEFLATE 

这是我用来在Google Pagespeedinsight上获得100%的Mod_deflateconfiguration

 # MOD_DEFLATE COMPRESSION SetOutputFilter DEFLATE AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript application/x-httpd-php # SET VAR SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip # DEFLATE NOT COMPATIBLE BROWERS BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html 

一旦更改完成,请不要忘记重启Apache服务