Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Compression on Apache 2.4.2 |
|
Author |
|
PeroKC
Joined: 26 Jun 2012 Posts: 3 Location: Croatia, Koprivnica
|
Posted: Tue 26 Jun '12 15:55 Post subject: Compression on Apache 2.4.2 |
|
|
Hello everyone,
I am having a problem with enabling compression on my local server. I followed bunch of tutorials on how to enable it but i can't get it to work.
I am using Apache 2.4.2 32bit, php 5.4.4 on Win7 64bit.
I uncommented
Code: | LoadModule deflate_module modules/mod_deflate.so |
and put following in httpd.conf
Code: | <IfModule mod_deflate.c>
# place filter 'DEFLATE' on all outgoing content
SetOutputFilter DEFLATE
# exclude uncompressible content via file type
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|rar|zip)$ no-gzip
<IfModule mod_headers.c>
# properly handle requests coming from behind proxies
Header append Vary User-Agent
</IfModule>
</IfModule>
# deflate.log, log compression ratio on each request
<IfModule mod_deflate.c>
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
CustomLog logs/deflate.log deflate
</IfModule>
# Properly handle old browsers that do not support compression
<IfModule mod_deflate.c>
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule> |
After that i restarted apache and when i enter my ip into Google page speed it says that i need to enable compression.
I tried using
Code: | AddOutputFilterByType DEFLATE text/html text/plain text/xml |
but than Apache won't start saying "Invalid command 'AddOutputFilterByType', perhaps misspelled or defined by a module not included in the server configuration".
I tried to uncomment mod_filter.so than invalid command goes away but i still get the Enable Compression warning from page speed. Can any of you please help me and tell me how to configure compression on Apache 2.4.2.
Thanks. |
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3092 Location: Hilversum, NL, EU
|
Posted: Tue 26 Jun '12 16:09 Post subject: |
|
|
This should work:
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \.(?:gif|jpg|png|ico|zip|gz)$ no-gzip
Remove the legacy BrowserMatch lines.
Check with http://web-sniffer.net/
Steffen |
|
Back to top |
|
PeroKC
Joined: 26 Jun 2012 Posts: 3 Location: Croatia, Koprivnica
|
Posted: Tue 26 Jun '12 16:50 Post subject: |
|
|
Thanks alot Steffen. Appreciate it. |
|
Back to top |
|
|
|
|
|
|