Pagespeed module for webservers for performance improvement by Google

Pagespeed module for webservers for performance improvement are available for various platform, which provides a caching layer at webserver level to improve the overall delivery of the request.

About Pagespeed Module

Google pagespeed Insights are available in google chrome developer console or from this page

https://pagespeed.web.dev/?utm_source=psi&utm_medium=redirect

It is commonly used to check insight of the page speed among devices with a percentage score, here is the example

It also provoides the pointers to improve the page performance.

Apart from this, Google also provides pagespeed module for different webservers like apache, nginx

Implementing Module at webserver

one can download the binary and install the module. Instructions for most of OS are available here

https://www.modpagespeed.com/doc/download

  • The module config can be setup at server level or vhost level, following is the vhost level
<IfModule mod_ssl.c>
<IfModule pagespeed_module>
  ModPagespeedInheritVHostConfig on
  ModPagespeedEnableFilters add_instrumentation
  ModPagespeedStatistics on
  ModPagespeedStatisticsLogging on
  ModPagespeedLogDir /var/log/pagespeed
</IfModule>
</IfModule>

Monitoring Statistics

There are different handler available which provides statistics of pagespede module

  • pagespeed_global_admin
  • pagespeed_admin
  • mod_pagespeed_statistics
  • mod_pagespeed_console
<IfModule pagespeed_module>
  <Location /mod_pagespeed_console>
      <IfModule mod_rewrite.c>
          RewriteEngine Off
      </IfModule>
       Order allow,deny
      Allow from localhost
      SetHandler mod_pagespeed_console
  </Location>
 
 <Location /mod_pagespeed_statistics>
    <IfModule mod_rewrite.c>
        RewriteEngine Off
    </IfModule>
    Order allow,deny
    Allow from localhost
    SetHandler mod_pagespeed_statistics
  </Location>
 
  <Location /pagespeed_admin>
    <IfModule mod_rewrite.c>
        RewriteEngine Off
    </IfModule>
    Order allow,deny
    Allow from localhost
    SetHandler pagespeed_admin
  </Location>
 
  <Location /pagespeed_global_admin>
    <IfModule mod_rewrite.c>
        RewriteEngine Off
    </IfModule>
    Order allow,deny
    Allow from localhost
    SetHandler pagespeed_global_admin
  </Location>
</IfModule>

when you type the url in browser from localhost as it is only allwoed from localhost “Allow from localhost” or you can put your ip to allow the request like “Allow from <ip>” for the vhost like,

<vhost url> / <handler>

like <vhsot url>/pagespeed_admin

output is like,

courtesy : https://developers.google.com/speed

Leave a Reply

Your email address will not be published. Required fields are marked *