Advertisements

How to Install Redis for WordPress

  • Post last modified:October 21, 2023
  • Post category:Linux / Web
  • Post comments:0 Comments
  • Reading time:7 mins read

In this post, I will show how to install Redis on your Linux server and install the Redis Cache plugin for WordPress.

Table of Contents:

What is Redis and Why Use it with WordPress?

Advertisements

Redis can serve as a caching layer for your WordPress site. It stores data in memory, allowing for reducing the load on your database server. By using Redis, you can cache database queries, objects, and even full-page output, resulting in faster page load times.

Step 1: Connect to Your Linux Server

Make SSH connection to your Linux server. You can use a tool like PuTTY (for Windows) or the terminal (for Linux and macOS) to connect to your server.

Step 2: Install Redis

update the server:

sudo apt update
sudo apt upgrade

install Redis:

sudo apt install redis-server

Step 3: Configure Redis

Redis should start automatically. However, it’s important to configure a few settings to optimize its performance. Open the Redis configuration file using a text editor:

sudo nano /etc/redis/redis.conf

Inside the configuration file, make the following changes:

  • Uncomment the line that starts with supervised and set its value to systemd.
config in redis
  • Uncomment the line that starts with maxmemory and set an appropriate value to limit Redis memory usage (e.g., 256mb for a server with limited resources).
setting ram to redis
  • Save the changes and exit the text editor.

Restart the Redis service to apply the configuration changes:

sudo systemctl restart redis

Step 4: Install and Configure the Redis Cache Plugin for WordPress

  • Log in to your WordPress admin dashboard.
  • Go to “Plugins” -> “Add New.”
  • Search for “Redis Object Cache” and click “Install Now”.
adding redis cache plugin to wordpress
  • Once the installation is complete, click “Activate” to enable the plugin.
  • Go to “Settings” -> “Redis” to configure the plugin.

Step 5: Verify Redis Integration

Advertisements

To verify that Redis is successfully integrated with WordPress, follow these steps:

  • Go to the Redis plugin settings page in your WordPress admin dashboard.
redis settings in wordpress
  • Go to the “Status” section.
  • If the status shows “Connected,” Redis is working correctly.
redis status check using wordpress
  • You can also check the “Metrics” section to see cache hit rates and usage.

Conclusion

You have successfully installed Redis on your Linux server and configured the Redis plugin for WordPress. You can significantly improve your site’s performance. Redis provides efficient in-memory caching, reducing the load on your database and speeding up page load times.

Leave a Reply