IBM HTTP Server and mod_deflate
¶
The Apache v2 module mod_deflate is extremely handy if you are serving IBM Connections up to remote locations with little bandwidth. Some of the Connections pages have large css or java script files that are required to function correctly but for countries that have poor connection to the remote server this causes slow page load times and sometimes timeouts.
The steps to enable this compression method
- Edit the httpd config and enable the deflate module
- Add the deflate information
- Set the deflate compression level to the desired level
- Add the information to the virtual hosts
- Restart the HTTP server
What you can save¶
Activating mod_deflate¶
Edit the httpd.conf file and ensure that the mod_deflate module is uncommented.
Before section 3 for virtual hosts – add the following entry to enable deflate.
## set deflate
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[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 already-compressed files
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .(?:avi|mov|mp3|mp4|rm|flv|swf|mp?g)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .pdf$ no-gzip dont-vary
DeflateCompressionLevel 9
### Section 3: Virtual Hosts
Note – The DeflateCompressionLevel set to 9 – this is the highest amount of compression. Depending on the load and size of your HTTP server this may use a lots of CPU time to deflate, this may need to be monitored and tuned for your specific server.
Inside the virtual host for the secure Connections server add the same deflate directive (see example below).
ServerName yourservername.com
SSLEnable
Include “/opt/IBM/HTTPServer/conf/rewrite.conf”
Header set Access-Control-Allow-Origin “*”
## set deflate
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[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 already-compressed files
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .(?:avi|mov|mp3|mp4|rm|flv|swf|mp?g)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .pdf$ no-gzip dont-vary
DeflateCompressionLevel 9
Restart the HTTP server and the deflate module will be active
Test the compression by visiting http://www.whatsmyip.org/http_compression/ and enter a url of a Connections page