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 through the step by step installation of WordPress content management systems on a Ubuntu 16.04 server.
Speed Up WordPress Using Redis Caching
Step 1. First, make sure that all your system packages are up-to-date by running these 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 package provides Redis itself, while the php-redis package provides a PHP extension for PHP applications like WordPress to communicate with Redis:
apt-get install redis-server apt-get install php-redis
Start and enable Redis on system boot:
systemctl start redis.service 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:
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 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.