Modern dynamic websites, especially WordPress, send dozens of queries to the database (MySQL) every time a page is loaded. As your number of visitors increases, these queries paralyze the processor (CPU) and RAM. Redis (Remote Dictionary Server) keeps the results of these queries on RAM (Object Caching), preventing the same query from going to the database again and again, and reducing response times to milliseconds.
Step 1: Installing Redis on the Server
Run the following commands with root privileges via SSH on your virtual server infrastructure with Ubuntu operating system:
sudo apt update
sudo apt install redis-server -y
When the installation is finished, check the status of Redis:
sudo systemctl status redis-server
Step 2: Redis Configuration (Security and Memory Limit)
We must set a limit so that Redis does not consume all the server RAM. Open the settings file:
sudo nano /etc/redis/redis.conf
Scroll to the bottom of the file and add the maximum memory and eviction policy:
maxmemory 256mb
maxmemory-policy allkeys-lru
This setting tells Redis to use a maximum of 256MB of RAM, and when it is full, to delete the oldest data to make room for new ones. Save the settings by restarting the service: sudo systemctl restart redis-server
Step 3: Installing the Redis Extension for PHP
For WordPress (PHP) to be able to talk to Redis, it needs the PHP-Redis module:
sudo apt install php-redis -y
sudo systemctl restart php8.1-fpm # Change according to your version
sudo systemctl restart nginx # Or Apache
Step 4: WordPress Integration
Log in to your WordPress admin panel (wp-admin). Find and install the "Redis Object Cache" plugin (developed by Till Krüss) from Plugins > Add New. After activating it, go to Settings > Redis and press the "Enable Object Cache" button. If the status appears as "Connected", your process has been successfully completed.
For your WooCommerce or news sites with high instant hits, you can choose İyibirNet Turkey VDS server packages with intensive RAM capacity where you can fully use in-memory technologies like Redis.