2017-07-27 60 views
0

我XAMPP與Apache 2.4.25版和PHP 5.6的話,我能在Apache的文件夾中的httpd.conf mod_deflate模塊和mod_filter:mod_deflate模塊不能正常工作在localhost

LoadModule deflate_module modules/mod_deflate.so 
LoadModule deflate_module modules/mod_filter.so 

我安裝了一個新的codeignter框架,然後寫在根文件夾中的文件.httaccess像這樣:

RewriteEngine on 
#RewriteBase /suli5 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule .* index.php/$0 [PT,L] 

# compress text, html, javascript, css, xml: 
SetOutputFilter DEFLATE 
AddOutputFilterByType DEFLATE text/css 
AddOutputFilterByType DEFLATE image/png 
AddOutputFilterByType DEFLATE image/jpg 
AddOutputFilterByType DEFLATE text/html 

# DEFLATE NOT COMPATIBLE BROWERS 
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip 
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然後我想,如果壓縮gzip的運行來驗證,所以我檢查

curl -I -H"Accept-Encoding: gzip" http://localhost/nees/ 

,但仍然沒有

Content-Encoding: gzip 

只給我這樣的:

TP/1.1 200 OK 
Date: Thu, 27 Jul 2017 03:26:00 GMT 
Server: Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 
X-Powered-By: PHP/5.6.30 
Set-Cookie: ci_session=vmbl2tgvt838hb9mlbrg226f4hu7j43u; expires=Thu, 27-Jul-2017 05:26:00 GMT; Max-Age=7200; path=/; HttpOnly 
Expires: Thu, 19 Nov 1981 08:52:00 GMT 
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 
Pragma: no-cache 
Content-Type: text/html; charset=UTF-8 

如何檢查是否我的mod_deflate模塊運行良好?

+0

所以我嘗試改變但仍然無法正常工作。我正在使用XAMPP –

+0

你好安迪卡,你有沒有得到這個工作?我也試圖使用mod_deflate,但它不適合我。我不知道這是否是一個錯字,但是當在Apache中加載模塊時,它是LoadModule filter_module modules/mod_filter.so,而不是LoadModule deflate_module modules/mod_filter.so – JBT

回答

0

就我而言,我設置爲httpd.conf中:

<IfModule deflate_module> 
SetOutputFilter DEFLATE 
SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip 
DeflateFilterNote Input instream 
DeflateFilterNote Output outstream 
DeflateFilterNote Ratio ratio 
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate 
CustomLog "logs/deflate_log" deflate 
</IfModule> 

請注意, - deflate_module這是我mod_deflate模塊的allias。