ServerPilot Pagespeed Message History

To enable Message History in Pagespeed on a server managed with ServerPilot – useful if you need to diagnose if there are any problems. You need to create a global level config file – adding it for a particular vhost isn’t good enough.

Create a file pagespeed.conf in /etc/nginx-sp/http.d

pagespeed on;
pagespeed MessageBufferSize 100000;
pagespeed FileCachePath /var/cache/pagespeed;
pagespeed Statistics on;
pagespeed StatisticsLogging on;
pagespeed LogDir /var/log/pagespeed;

Create the folder to hold the logs at:

mkdir /var/log/pagespeed;
chmod 755 /var/log/pagespeed;
chown www-data /var/log/pagespeed

This enables Pagespeed for all the sites on the server so if there are any that shouldn’t be using it, you’ll need to add pagespeed off; to a config file in that particular vhost folder.

WordPress WooCommerce SagePay mcrypt

WordPress WooCommerce SagePay Form extension https://woocommerce.com/products/sage-pay-form/ requires the PHP mcrypt extension to operate.

If your site uses this extension and one day stops going through the full checkout process be aware of the following:

mcrypt has been deprecated as of PHP 7.1.0 and will be moved to PECL as of PHP 7.2.0 – this is because it relies upon libmcrypt which is dead and unmaintained since 2007 http://php.net/manual/en/intro.mcrypt.php.

Your host may have disabled the mcrypt extension.

I’ve heard that the WooCommerce SagePay Form extension is currently being updated to use openssl_encrypt so there may be an update soon to rectify this.

Using ngrok to access multiple homestead sites remotely

ngrok can be used to provide access to a local homestead or vagrant site remotely i.e. to a client.

You need to use header rewriting to work with the homestead configuration, the syntax for using a single site looks like:

ngrok http -host-header=rewrite mysite.app:80

If you have multiple sites then you will need to use ngrok with a config file, stored in ~/.ngrox.config.yml. The docs are vague on how to do the rewriting in the config file so here it is for reference:

tunnels:
    mysite:
        addr: mysite.app:80
        proto: http
        host_header: rewrite
    myapi:
        addr: myapi.app:80
        proto: http
        host_header: rewrite

Note that host header rewriting doesn’t work nicely with cookies which seriously limits this.

See http://stackoverflow.com/questions/41523847/fail-to-create-cookies-while-using-ngrok-with-header-rewrite