How to configure httpd.conf file to enable zip compression on js, css and html files


We are using Apache 1.3 and would like to compress js, css and html files for optimisation. The mod_gzip component is enabled. Please could you help in specifying what configuration is required in the httpd.conf file to compress css, js and html files.

thanks in advance
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Monis MontherSystem ArchitectCommented:
1- make sure this line is un hashed (This enables the module)
Under httpd.conf

LoadModule deflate_module modules/

2- Under Your Virtual Host under your Directory where compression is to be enabled

AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript


3- (Optional ) you can add logging for deflate to verify and confirm that it is compressing

After the </Directory>

DeflateFilterNote Input input_info
DeflateFilterNote Output output_info
DeflateFilterNote Ratio ratio_info
LogFormat '"%r" %{output_info}n/%{input_info}n (%{ratio_info}n%%)' deflate
CustomLog /var/log/httpd/deflate_log deflate

Herre your log file is /var/log/httpd/deflate_log

Note: Its better to disable its logging once proven to work to avoid un-necessary writes to the disk
singh101Author Commented:
Is the mdoule available on Apache 1.3. I thought this was only for apache 2.0. Please confirm.
Monis MontherSystem ArchitectCommented:
Sorry Yes you are right, this is for apache 2.x for the older 1.3 its called mod_gzip

this is the how to


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Utilities

From novice to tech pro — start learning today.