UnixServerAdmin

Server Administration & Management

How to enable gzip compression in Tomcat

Add the following attributes to the <Connector> in Tomcat’s server.xml to enable gzip compression of responses at line no.- 70 :-

# vim apache-tomcat/conf/server.xml

    compression=”on” compressionMinSize=”2048″
    compressableMimeType=”text/html,text/xml,text/csv,text/css,text/javascript”

Before

<Connector port=”8080″ protocol=”HTTP/1.1″
                 connectionTimeout=”20000″
                 redirectPort=”8443″ /

After

<Connector port=”8080″ protocol=”HTTP/1.1″
               connectionTimeout=”20000″
               redirectPort=”8443″
               compression=”on” compressionMinSize=”2048″
               compressableMimeType=”text/html,text/xml,text/csv,text/css,text/javascript” />

Advertisements

March 23, 2013 - Posted by | Tomcat | ,

1 Comment »

  1. If you wish for to grow your know-how just keep visiting this site and be updated with the hottest news posted here.

    Comment by Adriene | April 18, 2013 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: