2016-07-07 49 views
0

我有一個簡單的系統緩存,我想知道當我壓縮這個緩存文件夾中的每個文件和請求頁面時,我解壓縮併發送它,這個操作是否影響速度?並會消耗更多的內存資源?關於壓縮緩存文件

注:我們的目標是節省空間


感謝

+0

阿帕奇已經有處理這 – unixmiah

+0

這聽起來像他做mod_deflate模塊的另一模塊文件。就像他正在壓縮緩存文件以節省服務器硬盤驅動器上的空間,然後將它們解壓縮一樣。 – stevecomrie

+0

我很無能。不知道他想要完成什麼。 – unixmiah

回答

0

你手工荏苒服務器上的緩存文件,然後手動解壓它們並將它們發送回瀏覽器,因爲它們是要求?

是的,這會對產生負面影響會影響您的表現。

相反,考慮使用類似mod_deflate的東西來自動縮小文件的大小,當它們發送到瀏覽器。

0

如果你正在運行的Apache Web服務器,就可以進入下面的一組代碼到你的.htaccess或Apache的conf文件,或與在線工具檢查,如果這是工作或沒有

<IfModule mod_deflate.c> 
    SetOutputFilter DEFLATE 
    <IfModule mod_setenvif.c> 
     # Netscape 4.x has some problems... 
     BrowserMatch ^Mozilla/4 gzip-only-text/html 

     # Netscape 4.06-4.08 have some more problems 
     BrowserMatch ^Mozilla/4\.0[678] no-gzip 

     # MSIE masquerades as Netscape, but it is fine 
     # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html 

     # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48 
     # the above regex won't work. You can use the following 
     # workaround to get the desired effect: 
     BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html 

     # Don't compress images 
     SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary 
    </IfModule> 
    <IfModule mod_headers.c> 
     # Make sure proxies don't deliver the wrong content 
     Header append Vary User-Agent env=!dont-vary 
    </IfModule> 
</IfModule> 

您可以調整並調整設置緩存,在命令行中,你可以檢查它是否荏苒

curl -I -H 'Accept-Encoding: gzip,deflate' www.domain.com