2011-01-12 65 views
2

Google Page Speed和YSlow說壓縮沒有啓用。Apache2 mod_deflate不能正常工作

這裏是我的配置:

NameVirtualHost *:80 
<VirtualHost *:80> 
     ServerName episodecalendar.com 
     ServerAlias www.episodecalendar.com 

     DocumentRoot /var/www/episodecalendar.com/production/current/public/ 
     <Directory /var/www/episodecalendar.com/production/current/public> 
       Options Indexes FollowSymLinks MultiViews 
       AllowOverride None 
       Order allow,deny 
       allow from all 
     </Directory> 

     ErrorLog /var/www/episodecalendar.com/production/current/error.log 

     # Possible values include: debug, info, notice, warn, error, crit, 
     # alert, emerg. 
     LogLevel warn 

     CustomLog /var/www/episodecalendar.com/production/current/access.log combined 
     ServerSignature On 

     #Gzip/deflate 
     AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/x-javascript 
     BrowserMatch ^Mozilla/4 gzip-only-text/html 
     BrowserMatch ^Mozilla/4\.0[678] no-gzip 
     BrowserMatch \bMSIE !no-gzip !gzip-only-text/html 

     DeflateFilterNote Input instream 
     DeflateFilterNote Output outstream 
     DeflateFilterNote Ratio ratio 

     LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate 
     CustomLog /var/log/apache2/deflate_log deflate 
</VirtualHost> 

我錯過了什麼?

mod_deflate模塊被啓用,而頭說:

Accept-Encoding gzip,deflate 

和實際日誌是這樣的:

"GET /stylesheets/application_packaged.css?1292696861 HTTP/1.1" 6927/31722 (21%) 
"GET /stylesheets/print.css?1292696853 HTTP/1.1" 323/625 (51%) 
"GET /javascripts/application_packaged.js?1292696861 HTTP/1.1" 25146/74582 (33%) 

PS。我使用mod-Raider運行Rails

+0

`Accept-Encoding`是一個客戶端頭,不是嗎? – 2011-01-12 11:30:08

回答

1

對不起我的壞。我在辦公室的代理服務器後面,所以當它到達我的電腦時,請求已經解壓。