nativeInstallerorocrm

Use PageSpeed with Apache

Before running the commands shown on this page, you should load the Bitnami stack environment by executing the installdir/use_APPNAME script (Linux and MacOS) or by clicking the shortcut in the Start Menu under “Start -> Bitnami APPNAME Stack -> Application console” (Windows). On OS X VMs, the installation directory is /opt/bitnami and OS X VM users can click the “Open Terminal” button to run commands. Learn more about the Bitnami stack environment and about OS X VMs.

IMPORTANT: PageSpeed is not supported on Windows native installers.

Check if PageSpeed is enabled

There are different ways to check if mod_pagespeed for Apache is already configured and running.

  • Check if the module and configuration files are active, by inspecting the installdir/apache2/conf/httpd.conf and looking for the following lines:

      Include conf/pagespeed.conf
      Include conf/pagespeed_libraries.conf
    

    The module will be located at installdir/apache2/modules/mod_pagespeed_ap24.so.

  • Check the source code of rendered application page. Images, CSS and JavaScript should appear in compressed form. For example, an image might be named sample.png.pagespeed.ic.ZWx38TQ7J5.png.

Check Pagespeed statistics

For security reasons, the PageSpeed application is accessible only when using 127.0.0.1 as the hostname. To access it from other IP addresses, follow these steps:

  • Enable remote access by editing the installdir/apache2/conf/pagespeed.conf file, disabling URL rewriting and replacing the localhost placeholder with your public IP address. Obtain your public IP address from https://myip.bitnami.com if required. Ensure that the final result looks like this:

      <Location /pagespeed_admin>
          <IfModule mod_rewrite.c>
            RewriteEngine Off
          </IfModule>
          Order allow,deny
          Allow from localhost
          Allow from 127.0.0.1
          Allow from localhost
          SetHandler pagespeed_admin
      </Location>
      <Location /pagespeed_global_admin>
        <IfModule mod_rewrite.c>
          RewriteEngine Off
        </IfModule>
          Order allow,deny
          Allow from localhost
          Allow from 127.0.0.1
          Allow from localhost
          SetHandler pagespeed_global_admin
      </Location>
    
  • Restart Apache to load the changes:

      $ sudo installdir/ctlscript.sh restart apache
    

You should now be able to check PageSpeed statistics by browsing to http://localhost/pagespeed_admin. Here is an example of what you should see:

PageSpeed console

TIP: Alternatively, check PageSpeed statistics using an SSH tunnel.

Disable PageSpeed

To disable PageSpeed, follow these steps:

  • Comment out the following lines in the installdir/apache2/conf/httpd.conf file:

      #Include conf/pagespeed.conf
      #Include conf/pagespeed_libraries.conf
    
  • Restart Apache:

      $ sudo installdir/ctlscript.sh restart apache
    

Flush the PageSpeed cache

To flush the PageSpeed cache, follow these steps:

  • Execute this command:

      $ sudo touch installdir/apache2/var/cache/mod_pagespeed/cache.flush
    
  • Restart Apache:

      $ sudo installdir/ctlscript.sh restart apache
    
Last modification September 28, 2021