Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

A beginner here so please bear with me!

I've just been assessing my websites performance and have been told that everything should be sent gzipped, namely:

The CSS files The JS files and the page itself

How do I go about doing this and should I, are there any disadvantages? Do you use it?

What happens if a browser does not support gzip? Is this possible?

Thanks to any advice in advance it's really appreicated!

share|improve this question

migrated from stackoverflow.com Dec 23 '09 at 0:53

This question came from our site for professional and enthusiast programmers.

    
Please tell us what web server software you are running. –  Joe Koberg Dec 22 '09 at 21:17
    
I don't know much about servers, but it says this: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 I'm assuming this means Apache? –  Thomas Carter Dec 22 '09 at 21:47
add comment

3 Answers

Typically, you can configure a web server to do the gzipping for you. A web server will usually check the headers in web requests to see if the browser accepts GZIP responses. The specifics of how you configure this depends on which type of web server you're using. Check Server Fault for advice on setting up GZIP in IIS or Apache.

share|improve this answer
add comment

Configure your web server to compress, and it will negotiate this option with the browser.

It should be transparent to your website code.

The disadvantage is increased CPU load on the server. This rarely matters for modern servers and reasonable traffic.

share|improve this answer
    
Thanks guys. Does this mean if the browser does not support gZip they will still get the contents as usual right? Sounds good, are there any other disadvantages other than increased CPU load? –  Thomas Carter Dec 22 '09 at 21:25
    
The web server will not send it unless the browser states that it supports it. I can't think of many disadvantages. You might avoid compressing images, MPG/WMV media, etc, just because it is of no benefit. But it doesn't hurt either. –  Joe Koberg Dec 22 '09 at 21:48
    
Thankyou very much, adding: SetOutputFilter DEFLATE to my htaccess seems to have done the trick! –  Thomas Carter Dec 22 '09 at 21:57
add comment

The webserver compresses the files automatically and the webbrowser decompresses them on arrival. This is transparent to your site/code and is configured in the webserver.

Read this article for how to enable it in Internet Information Server 6.0

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.