PageSpeed Module

How to handle 404 not found Pagespeed optimized resources in Nginx

Pagespeed rename the static resources (like images, CSS, etc.) file name to mark as optimized and there instances where the Pagespeed optimized web pages' resources returns 404 not found and for several browser refresh they eventually loads up. In this case, Pagespeed is still in the process of optimizing the web pages' resources. We can handle this issue by the following Nginx script:

Implementing Nginx PageSpeed module's Shard domains with Drupal site

The web browsers by default limits number of concurrent connections for each host. When that limit exceeds, the resources (like CSS, images, etc.) will remain in queue waiting to be downloaded until the prior downloads are completed. This results slow page load times user experience. One solution to reduce page load time is by domain sharding. This technique splits the resources download across multiple sub-domains (eg. static1.webfoobar.com, static2.webfoobar.com) resulting an increase in simultaneous connections.

Using Pagespeed with Nginx

Pagespeed is a quick way to optimize your site following web best practices. It is available as a module for Apache and Nginx. Installing this module in Apache is easy as:


sudo yum install at # if you do not already have 'at' installed
sudo rpm -U mod-pagespeed-*.rpm

To install Nginx, we need to compile the Nginx source in order to include Pagespeed module (please see this article for instructions). For Nginx configuration, please follow this guide.

How to setup Pagespeed module in Nginx using rpm or yum on CentOS 7

Adding Pagespeed module in Apache is very easy with package manager:


sudo yum install at # if you do not already have 'at' installed
sudo rpm -U mod-pagespeed-*.rpm

... but if we want to add Pagespeed module in Nginx, first thing we think of is compiling its source along with the Pagespeed module. What if Nginx is installed in our server from yum or rpm? The process we need is to repackage RPM and that is what this tutorial will show.