admin管理员组

文章数量:1122832

I have about 50 sites in my server. I have installed redis to be used for cache and trying to cinfigure redis object cache plugin. I have done all the configurations I have read. Without the WP_CACHE_KEY_SALT and WP_REDIS_DATABASE, all the domain links redirect to one website that has been cached. Here is an example of my wp-config.php

define('WP_REDIS_HOST', '127.0.0.1');
define('WP_REDIS_PORT', '6379');
define('WP_REDIS_PREFIX', 'uniqueprefix_');
//define('WP_REDIS_DATABASE', 1);
define( 'WP_CACHE_KEY_SALT', 'domainname.tld:' );

From the code above, I have tried using a different database, but I get an error. Tried using WP_CACHE_KEY_SALT still getting an error. All solutions from this link here have not worked.

Please help me figure out what I could be doing wrong. I am using hestia cp (nginx + apache2)

I have about 50 sites in my server. I have installed redis to be used for cache and trying to cinfigure redis object cache plugin. I have done all the configurations I have read. Without the WP_CACHE_KEY_SALT and WP_REDIS_DATABASE, all the domain links redirect to one website that has been cached. Here is an example of my wp-config.php

define('WP_REDIS_HOST', '127.0.0.1');
define('WP_REDIS_PORT', '6379');
define('WP_REDIS_PREFIX', 'uniqueprefix_');
//define('WP_REDIS_DATABASE', 1);
define( 'WP_CACHE_KEY_SALT', 'domainname.tld:' );

From the code above, I have tried using a different database, but I get an error. Tried using WP_CACHE_KEY_SALT still getting an error. All solutions from this link here have not worked.

Please help me figure out what I could be doing wrong. I am using hestia cp (nginx + apache2)

Share Improve this question asked Oct 22, 2023 at 13:27 Timothy MachTimothy Mach 113 bronze badges 3
  • How did you install Redis? Might be worth checking that it's running correctly, how you check will depend on the operating system of your host and how to installed Redis. – Hugo Commented Nov 4, 2023 at 16:02
  • sudo apt update sudo apt install redis-server sudo nano /etc/redis/redis.conf //here I bound my local ip address sudo apt install php-redis sudo service apache2 restart sudo service nginx restart – Timothy Mach Commented Nov 6, 2023 at 9:33
  • You say you bound it to your local IP address, was that 127.0.0.1? If not then you won't be able to connect through loopback, change your binding to 127.0.0.1 and then restart redis: sudo service redis* restart – Hugo Commented Nov 6, 2023 at 22:41
Add a comment  | 

1 Answer 1

Reset to default 0

I had the same issue lately and you need to configure WP_REDIS_PREFIX in wp-config.php

define( 'WP_REDIS_PREFIX', 'your_unique_key_for_each_wp_instance_' );

for each WP site. This solved my case.

本文标签: pluginsHow to configure redis object cache for multiple sites in the same server without errors