Definitive Guide to a FAST WordPress

WordPress is a great way of building and optimising a website for SEO. You can get excellent SEO results using a well tuned WordPress build. However, set up your WordPress installation wrong and it can be extremely slow.

WordPress is a CMS, you do not create static pages that a user finds and reads, instead when a user visits your site, your server asks a database what information should be displayed on that page and subsequently draws it for the visitor to view.

This makes it very easy to update content on your website as you do not need any special editing software you just log onto your site, change some words and hit save.

Having a seperate database though means there is an extra layer of things that can slow down the user experience (and yours while trying to edit pages etc!)

The first and possibly most important step therefore is your Server Setup:

Server Settings

We always recommend a decent LAMP set up to host your WordPress installation, there is a wide range of providers who can set up a LAMP install in minutes, ready for you to install your shiny new WordPress to.

Some things to bear in mind while setting up your server:

PHP

The version of PHP installed makes a huge difference to the speed of your WordPress site. Make sure yours is running at least version 7.4 to get the most speed out of your server.

To find out your version is as simple as opening a console window and typing php -v

If it is less than 7.4, get it upgraded ASAP!

MySQL

Again, it is important for performance (and security) to make sure you are running the latest version of MySQL again simply by typing mysql -v in a console window you can find the current version.

We recommend running at least version 8.0

It is also important to check your MySQL Server is running locally on your server, and also to ensure your wp-config.php file points to ‘localhost’ for the ‘DB_HOST’ setting, this is to make sure it is not hunting around trying to find the database everytime it needs it

define( 'DB_HOST', 'localhost' );

HTTP/2

HTTP/2 is essentially an upgraded version of the HTTP protocol which allows communication between web servers and clients. HTTP/2 is much faster, especially for mobile users which will make up a large chunk of your visitors.

It has to be enabled on your server, which if you have taken our advice on a LAMP setup can be done via the console in one simple step:

$ sudo a2enmod http2

You then need to modify the virtual host file (usually in the /etc/apache2/sites-enabled directory)

All you have to do is add the following underneath the <VirtualHost *:443> tag

Protocols h2 http/1.1

Restart the Apache webserver and you are good to go

sudo systemctl restart apache2

Now time to check that you are using HTTP/2 – we find the easiest way is to simply call up Google Developer Tools, click on Network and then refresh the page:

If it shows h2, you are all set and running on HTTP/2, it may even show HTTP/3 which is an even newer version of the protocol