What is the best way to add moddeflate to the Apache server without recompiling the Apache? I have a Linux server (Centos) and I have to add the moddeflate module. How to add mod_deflate to apache without recompiling?
First of all you have to add LDFLAGS="-lz" in apr-1-config file.
Then you should compile the
mod_deflate.c file. Use the following command to compile
cd /home/cpeasyapache/src/httpd-2.0.63/modules/filters/ /usr/local/apache/bin/apxs -i -c -Wl,lz mod_deflate.c
After that add the following code into httpd.conf file:
LoadModule deflate_module modules/mod_deflate.so
and then add the following line in httpd.conf:
<Location /> # Insert filter SetOutputFilter DEFLATE # 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 no-gzip # MSIE masquerades as Netscape, but it is fine BrowserMatch \bMSIE !no-gzip !gzip-only-text/html # Don't compress images SetEnvIfNoCase Request_URI \ \.(?:gif|jpe?g|png)$ no-gzip dont-vary # Make sure proxies don't deliver the wrong content Header append Vary User-Agent env=!dont-vary </Location>
After that restart the server. Your
mod_deflate.c should be working now.