In this tutorial, we will show you how to speed up WordPress using Redis caching on Ubuntu 16.04. For those of you who didn’t know, WordPress is an online, open-source website creation tool written in PHP. But in non-geek speak, it’s probably the easiest and most powerful blogging and website content management system (or CMS) in existence today.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of WordPress content management systems on a Ubuntu 16.04 server.
Prerequisites
- A server running one of the following operating systems: Ubuntu Linux.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Speed Up WordPress Using Redis Caching
Step 1. First, make sure that all your system packages are up-to-date by running the following apt-get
commands in the terminal.
sudo apt-get update sudo apt-get upgrade
Step 2. Installing WordPress
If you do not have WordPress installed, you can follow our guide here.
Step 3. Installing Redis.
In order to use Redis with WordPress, two packages need to be installed: redis-server
and php-redis
. The redis-server
the package provides Redis itself, while the php-redis
the package provides a PHP extension for PHP applications like WordPress to communicate with Redis:
sudo apt-get install redis-server sudo apt-get install php-redis
Start and enable Redis on system boot:
sudo systemctl start redis.service sudo systemctl enable redis.service
Step 4. Install Redis Caching Plugin in WordPress.
After installing Redis and the PHP Redis client extension, login to your WordPress Dashboard, and select Add New from the Plugins menu.
Then, search for “Redis Object Cache” and click Install Now on the matching result.
Next, navigate to Settings > Redis and click on Enable Object Cache to enable the object caching in WordPress. The default configuration should work out of the box since the default Redis listening address is 127.0.0.1 and the default listening port is 6379.
Step 5. Verify WordPress caching.
To check whether the WordPress caching works OK with Redis you can connect to your server via SSH and run the following command:
redis-cli monitor
When you run this command, you will see the real-time output of Redis serving cached queries. If you don’t see anything, visit your website and reload a page.
Congratulations! You have successfully installed WordPress with Redis Caching. Thanks for using this tutorial to speed up WordPress CMS (Content Management Systems) on your Ubuntu 16.04 (xenial xerus) system. For additional help or useful information, we recommend you to check the official WordPress website.