WordPressing the Cloud – Part 3

WordPressing the Cloud – Part 3

July 1, 2018 By Jake

Set up HTTP/2 and mod_pagespeed for WordPress on Google Cloud using the Bitnami LAMP Stack, mod_Pagespeed and using a Bucket as a CDN

This is part 3 of “WordPressing” in the Google Cloud. In this part I will discuss enabling HTTP/2, setting up the Google Storage Bucket to deliver static content (like a CDN) and configuring mod_pagespeed to work with this WordPress setup.

(I am providing links to the documentation from Bitnami, their community forums, and Google.  These will show the procedure to follow. In some instances I am providing the procedure myself, where I found the answer in several different sources.)

How do I enable HTTP/2 on my Bitnami LAMP stack?

HTTP/2 is a great tool for achieving the load times necessary to have a successful website. To enable it on this stack you need to edit

 /opt/bitnami/apache2/conf/httpd.conf

configuration file and uncomment the line

  #LoadModule http2_module modules/mod_http2.so

and save the file.

Then you will want to edit the file

 /opt/bitnami/apache2/conf/bitnami/bitnami.conf

configuration file. You will need to add this line at the top of the file if you want to enable HTTP/2 for all the virtual hosts:

h2 h2c http/1.1

Now restart the apache service using this command:

/opt/bitnami/ctlscript.sh restart apache

You can use https://tools.keycdn.com/http2-test to check and make sure it is enabled.

Please Note: We have since the time of this post changed our configuration.  We no longer use the Google Bucket for static files, Wp-Stateless, and our settings for the Pagespeed Module have changed.  See this Post.

How do I set up one of my Google storage buckets to serve static content like a CDN?

You will need to set the permissions on your storage bucket first to make it public. You will also need to add the user you authenticated in part 2 of this series (Set up gcloud authentication to use gsutil cp to move files to the new server and the static storage bucket) as an administrator.

Since I am using WordPress, I do use a plugin here for the images. This is an excellent plugin and is written well, it is called WP-Stateless. The configuration I use is:

    • Mode: CDN
    • File URL Replacement: Enable
    • Supported File Types: jpg jpeg png gif pdf
    • Cache-Control: public, max-age=2592000
    • Cache-Busting: Enable
    • Under the compatibility tab, Dynamic Image Support: Enable

I use the Timber Boot theme, of course. This template has additional images sizes and supports retina displays.  If your template has additional image sizes, you may want to follow the same procedure after configuring and enabling WP-Stateless.

  • Use the Plugin Regenerate Thumbnails and regenerate all images.
  • Under the Synch Tab on WP-Stateless choose “Regenerate all stateless images and synchronize Google Storage with local server” and run it.

This plugin will handle everything for you concerning the images.

Next, you want to move your CSS and JS files to the bucket also. To do this make sure you have set up gcloud authentication to use gsutil cp to move files to the new server and the static storage bucket.

When moving them you want to compress the data and set the Content-Encoding to gzip by using the -z option using the gsutil cp. Do this for each static resource you want to serve from the bucket other than the images (This is handled by the plugin previously installed.)

To move your CSS you would use this command, modifying it for your file name, location, and bucket name:

gsutil cp -z css -a public-read \
app.css gs://mybucket/assets

To move your JS you would use this command, modifying it for your file name, location, and bucket name:

gsutil cp -z js -a public-read \
app.js gs://mybucket/assets

After doing this, you do want to set the Cache-Control for these resources so that mod_pagespeed can process them. Use the commands below modifying them for your file name, location, and bucket name.

gsutil setmeta -h “Content-Type:application/javascript” \
-h “Cache-Control:public, max-age=3600” \
-h “Content-Disposition” gs://mybucket/assets/app.js
gsutil setmeta -h “Content-Type:text/css” \
-h “Cache-Control:public, max-age=3600” \
-h “Content-Disposition” gs://mybucket/assets/app.css

After this change any calls to your css or js files to the path on your bucket, for example:

src=’https://storage.googleapis.com/mybucket/assets/app.js

src=’https://storage.googleapis.com/mybucket/assets/app.js

src=’https://storage.googleapis.com/mybucket/assets/app.js

Now your storage bucket is set up to deliver static content like a CDN.

How do I set up mod_pagespeed for a Bitnami LAMP server and WordPress on the Google Cloud ?

Even though I do use HTTP/2, I still use mod_pagespeed to handle some of the other chores.  First, make sure it is enabled by following this guide.

The key to using this module is to not let it do all the work. I always optimize my own images the best I can, minify my CSS and JS, and write clean code.  I rely on writing code, rather than using a plugin if possible.

You can and should read this guide about mod_pagespeed.  There are also some great Google Groups for using and configuring it, even with WordPress. Finding what I considered the optimal configuration took hours of testing and research.

I am going to give you the configurations I use, but you will need to change them to fit your site(s).  I suggest looking at each configuration and referring to the documentation so you fully understand what it is doing. At the same time, I will give you the other configurations files that were used in this 3 part series.

Please Note: We have since the time of this post changed our configuration.  We no longer use the Google Bucket for static files, Wp-Stateless, and our settings for the Pagespeed Module have changed.  See this Post.

In the configuration file for mod_pagespeed:

/opt/bitnami/apache2/conf/pagespeed.conf

Look for the settings between <IfModule pagespeed_module> and </IfModule> and make sure they are set to:


  <IfModule pagespeed_module>
    ModPagespeed on
    AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
    ModPagespeedFileCachePath            "/opt/bitnami/apache2/var/cache/mod_pagespeed/"
    ModPagespeedLogDir "/opt/bitnami/apache2/logs/pagespeed_log"
    ModPagespeedSslCertDirectory "/opt/bitnami/common/openssl/certs"
    ModPagespeedDisableRewriteOnNoTransform off
    ModPagespeedFileCacheSizeKb          5120000
    ModPagespeedEnableFilters extend_cache
    ModPagespeedStatisticsLogging on
    ModPagespeedEnableCachePurge on
    ModPagespeedPurgeMethod PURGE
    ModPagespeedPreserveUrlRelativity on
    ModPagespeedCriticalImagesBeaconEnabled true
    ModPagespeedUsePerVhostStatistics on
    ModPagespeedMessageBufferSize 100000
    ModPagespeedRewriteLevel OptimizeForBandwidth
    ModPagespeedDisableFilters combine_javascript,combine_css,sprite_images
    ModPagespeedEnableFilters insert_dns_prefetch,lazyload_images
    ModPagespeedLazyloadImagesAfterOnload off
    ModPagespeedLazyloadImagesBlankUrl "https://www.gstatic.com/psa/static/1.gif"
    <Location /wp-admin/>
    ModPagespeed Off
    </Location>    
  </IfModule>

Single site WordPress module’s configuration files

For each of your single site WordPress modules set these configuration files as shown below. Make sure to change the path names or file names to fit your configuration.

/opt/bitnami/apps/wordpress/conf/httpd-vhosts.conf

 Protocols h2 h2c http/1.1
 <VirtualHost *:80>
 ServerName yoursite.com
 ServerAlias www.yoursite.com
 DocumentRoot "/opt/bitnami/apps/wordpress/htdocs"
 ModPagespeedDisallow "https://php file to not process.php"
 ModPagespeedDisallow "https://directory to not process/*"
 Protocols h2 h2c http/1.1
 Include "/opt/bitnami/apps/wordpress/conf/httpd-app.conf"
 </VirtualHost>

 <VirtualHost *:443>
 ServerName yoursite.com
 ServerAlias www.yoursite.com
 DocumentRoot "/opt/bitnami/apps/wordpress/htdocs"
 Protocols h2 h2c http/1.1
 SSLEngine on
 SSLCertificateFile "/opt/bitnami/apache2/conf/server.crt"
 SSLCertificateKeyFile "/opt/bitnami/apache2/conf/server.key"
 ModPagespeedInPlaceResourceOptimization on
 ModPagespeedMapOriginDomain http://localhost https://yoursite.com

 ModPagespeedMapOriginDomain http://storage.googleapis.com/your-bucket-name https://storage.googleapis.com/your-bucket-name
 ModPagespeedEnableFilters defer_javascript
 ModPagespeedEnableFilters inline_preview_images,resize_mobile_images,insert_image_dimensions
 ModPagespeedEnableFilters prioritize_critical_css
 ModPagespeedDisallow "https://php file to not process.php"
 ModPagespeedDisallow "https://directory to not process/*"
 Include "/opt/bitnami/apps/wordpress/conf/httpd-app.conf"
 </VirtualHost>

Notes: If there are any specific php files or directories you do not want Pagespeed to process, (such as shopping carts, payment processing) this is the syntax:
ModPagespeedDisallow “https://php file to not process.php
ModPagespeedDisallow “https://directory to not process/*

/opt/bitnami/apps/wordpress/conf/htaccess.conf

This file is probably as below by default.

<Directory "/opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/akismet">
# Only allow direct access to specific Web-available files.

# Apache 2.2
<IfModule !mod_authz_core.c>
Order Deny,Allow
Deny from all
</IfModule>

# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

# Akismet CSS and JS
<FilesMatch "^(form\.js|akismet\.js|akismet\.css)$">
<IfModule !mod_authz_core.c>
Allow from all
</IfModule>

<IfModule mod_authz_core.c>
Require all granted
</IfModule>
</FilesMatch>

# Akismet images
<FilesMatch "^logo-full-2x\.png$">
<IfModule !mod_authz_core.c>
Allow from all
</IfModule>

<IfModule mod_authz_core.c>
Require all granted
</IfModule>
</FilesMatch>
</Directory>
/opt/bitnami/apps/wordpress/conf/httpd-app.conf

RewriteEngine On
RewriteRule /<none> / [L,R]

<IfDefine USE_PHP_FPM>
<Proxy "unix:/opt/bitnami/php/var/run/wordpress.sock|fcgi://wordpress-fpm" timeout=300>
</Proxy>
</IfDefine>

<Directory "/opt/bitnami/apps/wordpress/htdocs">
Options +MultiViews +FollowSymLinks
AllowOverride None
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>

<IfDefine USE_PHP_FPM>
<FilesMatch \.php$>
SetHandler "proxy:fcgi://wordpress-fpm"
</FilesMatch>
</IfDefine>

<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>

<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType text/html "access plus 3 days"
ExpiresByType text/xml "access plus 1 seconds"
ExpiresByType text/plain "access plus 1 seconds"
ExpiresByType application/xml "access plus 1 seconds"
ExpiresByType application/rss+xml "access plus 1 seconds"
ExpiresByType application/json "access plus 1 seconds"
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/javascript "access plus 1 week"
ExpiresByType application/javascript "access plus 1 week"
ExpiresByType application/x-javascript "access plus 1 week"
ExpiresByType image/x-ico "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType application/pdf "access plus 1 month"
<IfModule mod_headers.c>
Header unset ETag
Header unset Pragma
Header unset Last-Modified
Header append Cache-Control "public, no-transform, must-revalidate"
</IfModule>
</IfModule>

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

</Directory>
<IfModule pagespeed_module>
ModPagespeedEnableFilters add_instrumentation
ModPagespeedStatistics on
ModPagespeedStatisticsLogging on
ModPagespeedLogDir "/opt/bitnami/apache2/logs/pagespeed_log"

<Location /mod_pagespeed_console>
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>

Order allow,deny
Allow from localhost
Allow from 127.0.0.1
Allow from your workstation ip
SetHandler mod_pagespeed_console
</Location>

<Location /mod_pagespeed_beacon>
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
SetHandler mod_pagespeed_beacon
</Location>

<Location /mod_pagespeed_statistics>
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
Order allow,deny
Allow from localhost
Allow from your workstation ip
SetHandler mod_pagespeed_statistics
</Location>

<Location /pagespeed_admin>
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
Order allow,deny
Allow from localhost
Allow from 127.0.0.1
Allow from your workstation ip
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 your workstation ip
SetHandler pagespeed_global_admin
</Location>

</IfModule>

Include "/opt/bitnami/apps/wordpress/conf/htaccess.conf"

Note:   The sections <Location /mod_pagespeed *> are for accessing the administration area for mod_pagespeed.  In the area Allow from your workstation IP replace your workstation IP with the IP address of your workstation you will be using to see the stats.

Multisite WordPress module’s configuration files

For your multisite WordPress module set these configuration files as shown below. Make sure to change the path names or file names to fit your configuration.

/opt/bitnami/apps/wordpressxx/conf/httpd-vhosts.conf

Protocols h2 h2c http/1.1
<VirtualHost *:80>
ServerName main-site-of-multisite.com
ServerAlias www.main-site-of-multisite.com
DocumentRoot "/opt/bitnami/apps/wordpressxx/htdocs"
Protocols h2 h2c http/1.1
Include "/opt/bitnami/apps/wordpressxx/conf/httpd-app.conf"
</VirtualHost>

<VirtualHost *:443>
ServerName main-site-of-multisite.com
ServerAlias www.main-site-of-multisite.com
DocumentRoot "/opt/bitnami/apps/wordpressxx/htdocs"
Protocols h2 h2c http/1.1
SSLEngine on
SSLCertificateFile "/opt/bitnami/apps/wordpressxx/conf/certs/main-site-of-multisite-server.crt"
SSLCertificateKeyFile "/opt/bitnami/apps/wordpressxx/conf/certs/main-site-of-multisite-server.key"
ModPagespeedInPlaceResourceOptimization on
ModPagespeedMapOriginDomain http://localhost https://main-site-of-multisite.com
ModPagespeedLoadFromFile https://main-site-of-multisite.com/ /opt/bitnami/apps/wordpressxx/htdocs/;
ModPagespeedLoadFromFileRuleMatch disallow .*;
ModPagespeedLoadFromFileRuleMatch allow \.css$;
ModPagespeedLoadFromFileRuleMatch allow \.js$;
ModPagespeedMapOriginDomain http://storage.googleapis.com/bucket-name https://storage.googleapis.com/bucket-name
ModPagespeedEnableFilters defer_javascript,rewrite_style_attributes_with_url
ModPagespeedEnableFilters inline_preview_images,resize_mobile_images,insert_image_dimensions
ModPagespeedEnableFilters prioritize_critical_css
ModPagespeedEnableFilters fallback_rewrite_css_urls
Include "/opt/bitnami/apps/wordpressxx/conf/httpd-app.conf"
</VirtualHost>

Include "/opt/bitnami/apps/wordpressxx/conf/httpd-app.conf"
</VirtualHost>

<VirtualHost *:80>
ServerName multisite1.com
ServerAlias www.multisite1.com
DocumentRoot "/opt/bitnami/apps/wordpressxx/htdocs"
Protocols h2 h2c http/1.1
Include "/opt/bitnami/apps/wordpressxx/conf/httpd-app.conf"
</VirtualHost>
<VirtualHost *:443>
ServerName multisite1.com
ServerAlias www.multisite1.com
DocumentRoot "/opt/bitnami/apps/wordpressxx/htdocs"
Protocols h2 h2c http/1.1
SSLEngine on
SSLCertificateFile "/opt/bitnami/apps/wordpressxx/conf/certs/multisite1-server.crt"
SSLCertificateKeyFile "/opt/bitnami/apps/wordpressxx/conf/certs/multisite1-server.key"
ModPagespeedInPlaceResourceOptimization on
ModPagespeedMapOriginDomain http://localhost https://multisite1.com
ModPagespeedLoadFromFile https://multisite1.com/ /opt/bitnami/apps/wordpressxx/htdocs/;
ModPagespeedLoadFromFileRuleMatch disallow .*;
ModPagespeedLoadFromFileRuleMatch allow \.css$;
ModPagespeedLoadFromFileRuleMatch allow \.js$;
ModPagespeedDomain https://main-site-of-multisite.com
ModPagespeedMapOriginDomain http://storage.googleapis.com/bucket-name https://storage.googleapis.com/bucket-name
ModPagespeedEnableFilters defer_javascript,rewrite_style_attributes_with_url
ModPagespeedEnableFilters inline_preview_images,resize_mobile_images,insert_image_dimensions
ModPagespeedEnableFilters prioritize_critical_css
ModPagespeedEnableFilters fallback_rewrite_css_urls
Include "/opt/bitnami/apps/wordpressxx/conf/httpd-app.conf"
</VirtualHost>

<VirtualHost *:80>
ServerName multisite2.com
ServerAlias www.multisite2.com
DocumentRoot "/opt/bitnami/apps/wordpressxx/htdocs"
Protocols h2 h2c http/1.1
Include "/opt/bitnami/apps/wordpressxx/conf/httpd-app.conf"
</VirtualHost>
<VirtualHost *:443>
ServerName multisite2.com
ServerAlias www.multisite2.com
DocumentRoot "/opt/bitnami/apps/wordpressxx/htdocs"
Protocols h2 h2c http/1.1
SSLEngine on
SSLCertificateFile "/opt/bitnami/apps/wordpressxx/conf/certs/multisite2-server.crt"
SSLCertificateKeyFile "/opt/bitnami/apps/wordpressxx/conf/certs/multisite2-server.key"
ModPagespeedMapOriginDomain http://localhost https://multisite2.com
ModPagespeedLoadFromFile https://multisite2.com/ /opt/bitnami/apps/wordpressxx/htdocs/;
ModPagespeedLoadFromFileRuleMatch disallow .*;
ModPagespeedLoadFromFileRuleMatch allow \.css$;
ModPagespeedLoadFromFileRuleMatch allow \.js$;
ModPagespeedDomain main-site-of-multisite.com
ModPagespeedMapOriginDomain http://storage.googleapis.com/bucket-name https://storage.googleapis.com/bucket-name
ModPagespeedEnableFilters defer_javascript,rewrite_style_attributes_with_url
ModPagespeedEnableFilters inline_preview_images,resize_mobile_images,insert_image_dimensions
ModPagespeedEnableFilters prioritize_critical_css
ModPagespeedEnableFilters fallback_rewrite_css_urls
Include "/opt/bitnami/apps/wordpressxx/conf/httpd-app.conf"
</VirtualHost>
/opt/bitnami/apps/wordpressxx/conf/htaccess.conf
<Directory "/opt/bitnami/apps/wordpressxx/htdocs">
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
</Directory><Directory "/opt/bitnami/apps/wordpressxx/htdocs/wp-content/plugins/akismet">
# Only allow direct access to specific Web-available files.# Apache 2.2
<IfModule !mod_authz_core.c>
Order Deny,Allow
Deny from all
</IfModule># Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

# Akismet CSS and JS
<FilesMatch "^(form\.js|akismet\.js|akismet\.css)$">
<IfModule !mod_authz_core.c>
Allow from all
</IfModule>

<IfModule mod_authz_core.c>
Require all granted
</IfModule>
</FilesMatch>

# Akismet images
<FilesMatch "^logo-full-2x\.png$">
<IfModule !mod_authz_core.c>
Allow from all
</IfModule>

<IfModule mod_authz_core.c>
Require all granted
</IfModule>
</FilesMatch>
</Directory>

 

/opt/bitnami/apps/wordpressxx/conf/httpd-app.conf

 


RewriteEngine On
RewriteRule /<none> / [L,R]

<IfDefine USE_PHP_FPM>
<Proxy "unix:/opt/bitnami/php/var/run/wordpressxx.sock|fcgi://wordpressxx-fpm" timeout=300>
</Proxy>
</IfDefine>

<Directory "/opt/bitnami/apps/wordpressxx/htdocs">
Options +MultiViews +FollowSymLinks
AllowOverride None
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>

<IfDefine USE_PHP_FPM>
<FilesMatch \.php$>
SetHandler "proxy:fcgi://wordpressxx-fpm"
</FilesMatch>
</IfDefine>

<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>

<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType text/html "access plus 3 days"
ExpiresByType text/xml "access plus 1 seconds"
ExpiresByType text/plain "access plus 1 seconds"
ExpiresByType application/xml "access plus 1 seconds"
ExpiresByType application/rss+xml "access plus 1 seconds"
ExpiresByType application/json "access plus 1 seconds"
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/javascript "access plus 1 week"
ExpiresByType application/javascript "access plus 1 week"
ExpiresByType application/x-javascript "access plus 1 week"
ExpiresByType image/x-ico "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType application/pdf "access plus 1 month"
<IfModule mod_headers.c>
Header unset ETag
Header unset Pragma
Header unset Last-Modified
Header append Cache-Control "public, no-transform, must-revalidate"
</IfModule>
</IfModule>

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

</Directory>
<IfModule pagespeed_module>
ModPagespeedEnableFilters add_instrumentation
ModPagespeedStatistics on
ModPagespeedStatisticsLogging on
ModPagespeedLogDir "/opt/bitnami/apache2/logs/pagespeed_log"

<Location /mod_pagespeed_console>
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>

Order allow,deny
Allow from localhost
Allow from 127.0.0.1
Allow from your workstation ip
SetHandler mod_pagespeed_console
</Location>

<Location /mod_pagespeed_beacon>
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
SetHandler mod_pagespeed_beacon
</Location>

<Location /mod_pagespeed_statistics>
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
Order allow,deny
Allow from localhost
Allow from your workstation ip
SetHandler mod_pagespeed_statistics
</Location>

<Location /pagespeed_admin>
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
Order allow,deny
Allow from localhost
Allow from 127.0.0.1
Allow from your workstation ip
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 your workstation ip
SetHandler pagespeed_global_admin
</Location>

</IfModule>

Include "/opt/bitnami/apps/wordpress/conf/htaccess.conf"

That is how I spent a couple of hours a day for the last 2 weeks.  So how did it work out?  My main site for mobile load time went from 5 seconds to 3 seconds.  I am happy I hope it works that well for you also. This all boils down to my addiction to speed. I want the mobile site I visit to load in 3 seconds.  I will give it 5 seconds, but any longer than that, there is a 75% chance I have already left your site. These are 4G numbers.  Remember, most people still use 3G, and I shoot for 8 seconds or less on 3G.

If you would like to message me, have any feedback or comments, or a question you need to be answered using the contact us form.

Part 1 of this series

Part 2 of this series