linux poison RSS
linux poison Email

Configure Apache HTTP server with mod-pagespeed for high performance

mod_pagespeed is an open-source Apache module that automatically optimises web pages and resources on them. It does this by rewriting the resources using filters that implement web performance best practices. Web masters and web developers can use mod_pagespeed to improve the performance of their web pages when serving content with the Apache HTTP Server.

mod_pagespeed includes several filter that optimise JavaScript, HTML and CSS stylesheets. It also includes filters for optimizing JPEG and PNG images. The filters are based on a set of best practices known to enhance web page performance. Webmasters who set up mod_pagespeed in addition to configuring proper caching and compression on their Apache distribution should expect to see an improvement in the loading time of the pages on their websites.

mod_pagespeed currently only supports Apache 2.2.

mod_pagespeed Installation:
Download the latest version of mod_pagespeed (deb file) for Ubuntu system - 32bit | 64bit

To install the packages, on Debian/Ubuntu, please run (as root) the following command:
dpkg -i mod-pagespeed-*.deb
apt-get -f install
Installing mod_pagespeed will add the Google repository so your system will automatically keep mod_pagespeed up to date.

After installing mod_pagespeed, it can be customized and configured by editing the Apache configuration file /etc/apache2/mods-enabled/pagespeed.conf

mod_pagespeed Configuration:
Open the mod_pagespeed configuration file using command:
sudo nano /etc/apache2/mods-available/pagespeed.conf
Below is my configuration setting, just paste this and restart apache server and you’re good to go.
ModPagespeedEnableFilters combine_css
ModPagespeedEnableFilters rewrite_css,rewrite_javascript
ModPagespeedEnableFilters inline_css,inline_javascript
ModPagespeedEnableFilters rewrite_images
ModPagespeedEnableFilters insert_img_dimensions
ModPagespeedEnableFilters remove_comments
ModPagespeedEnableFilters extend_cache
ModPagespeedEnableFilters remove_quotes
ModPagespeedDomain http://www.whateveryoursiteis.com
mod_pagespeed required a disk cache that must be configured to a directory to which httpd has write access. The default configuration file sets this to /var/mod_pagespeed/cache/. To put the cache elsewhere please edit ModPagespeedFileCachePath to the desired location. A quick glance at the Apache error log file, typically in /var/log/apache2/error.log, will indicate whether the current setting is working.

After editing the conf file, you must restart the httpd server:
sudo /etc/init.d/apache2ctl restart
Turning OFF mod_pagespeed
To turn off mod_pagespeed completely, insert as the top line of pagespeed.conf and restart your apache server:
ModPagespeed off
Turning ON mod_pagespeed
To turn mod_pagespeed ON, insert as the top line of pagespeed.conf and restart your apache server:
ModPagespeed on
There are many more mod_pagespeed configuration you can do, please do check this out for more details.

You can also download a number of system tests to check the improvement in performance.


2 comments:

Anonymous said...

Very good article. am looking forward to hear more from you. This blog doing well by introducing new softwares/tools, which helps to webmasters and system administrator on day to day life.

Srinivas

Unknown said...

Isn't ModPagespeedDomain suppose to be written without the http:// portion?

Post a Comment

Related Posts with Thumbnails