• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Input How to setup redis and use it as object-cache backend for WordPress

I am getting following in docker :

[0m[1mWelcome to the Bitnami redis container[0m
[0mSubscribe to project updates by watching [1mhttps://github.com/bitnami/bitnami-docker-redis[0m
[0mSubmit issues and feature requests at [1mhttps://github.com/bitnami/bitnami-docker-redis/issues[0m
[0m
Error executing 'postInstallation': Files to substitute resolved to an empty list

how to resolve this error???
 
there is object-cache.php in wp-content folder, i am using WP fastest Cache an auto-optimize.

There may have some incompatibilities between WP fastest Cache and Redis-Object-Cache, but do you use a plugin named Transient Cleaner ?
Because Transient Cleaner isn't compatible with an external object-cache.


Sorry I haven't seen there was new posts after this one.

But to answer to your question about the deployment of bitnami-docker-redis, are you trying to setup another VPS for redis ?
 
Last edited:
How do I see Redis RAM usage by Bitnami/redis docker image

Hello @Jaber Al Nahian, you just have to click on the container name in Plesk and it will dispay the container logs and RAM usage :

docker-redis.png
 
@vitubox

really a good example, do you have an example how to use nginx with redis as cache (nginx.conf) and Plesk, without using php now is well?
or is redis cache with php the better solution?

thanks in advance

MK

Code:
:/etc/nginx# nginx -V
nginx version: nginx/1.14.1 (VirtuBox Nginx-ee)
built by gcc 7.3.0 (Ubuntu 7.3.0-23ubuntu2~16.04.york0)
built with OpenSSL 1.1.1  11 Sep 2018
TLS SNI support enabled
configure arguments: --add-module=/usr/local/src/naxsi/naxsi_src --with-cc-opt='-m64 -march=native -DTCP_FASTOPEN=23 -g -O3 -fstack-protector-strong -flto -fuse-ld=gold --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wimplicit-fallthrough=0 -fcode-hoisting -Wp,-D_FORTIFY_SOURCE=2 -gsplit-dwarf' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --modules-path=/usr/share/nginx/modules --build='VirtuBox Nginx-ee' --user=nginx --group=nginx --without-http_uwsgi_module --without-mail_imap_module --without-mail_pop3_module --without-mail_smtp_module --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_mp4_module --with-http_sub_module --with-file-aio --with-threads --with-zlib=/usr/local/src/zlib --add-module=/usr/local/src/ngx_cache_purge --add-module=/usr/local/src/headers-more-nginx-module --add-module=/usr/local/src/memc-nginx-module --add-module=/usr/local/src/ngx_devel_kit --add-module=/usr/local/src/ngx_brotli --add-module=/usr/local/src/echo-nginx-module --add-module=/usr/local/src/ngx_http_substitutions_filter_module --add-module=/usr/local/src/redis2-nginx-module --add-module=/usr/local/src/srcache-nginx-module --add-module=/usr/local/src/set-misc-nginx-module --add-module=/usr/local/src/ngx_http_redis --add-module=/usr/local/src/ngx_http_auth_pam_module --add-module=/usr/local/src/nginx-module-vts --add-module=/usr/local/src/ipscrubtmp/ipscrub --add-module=/usr/local/src/incubator-pagespeed-ngx-latest-stable --with-openssl=/usr/local/src/openssl --with-openssl-opt='enable-ec_nistp_64_gcc_128 enable-tls1_3' --with-zlib=/usr/local/src/zlib --sbin-path=/usr/sbin/nginx
 
@vitubox

really a good example, do you have an example how to use nginx with redis as cache (nginx.conf) and Plesk, without using php now is well?
or is redis cache with php the better solution?

thanks in advance

MK

Code:
:/etc/nginx# nginx -V
nginx version: nginx/1.14.1 (VirtuBox Nginx-ee)
built by gcc 7.3.0 (Ubuntu 7.3.0-23ubuntu2~16.04.york0)
built with OpenSSL 1.1.1  11 Sep 2018
TLS SNI support enabled
configure arguments: --add-module=/usr/local/src/naxsi/naxsi_src --with-cc-opt='-m64 -march=native -DTCP_FASTOPEN=23 -g -O3 -fstack-protector-strong -flto -fuse-ld=gold --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wimplicit-fallthrough=0 -fcode-hoisting -Wp,-D_FORTIFY_SOURCE=2 -gsplit-dwarf' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --modules-path=/usr/share/nginx/modules --build='VirtuBox Nginx-ee' --user=nginx --group=nginx --without-http_uwsgi_module --without-mail_imap_module --without-mail_pop3_module --without-mail_smtp_module --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_mp4_module --with-http_sub_module --with-file-aio --with-threads --with-zlib=/usr/local/src/zlib --add-module=/usr/local/src/ngx_cache_purge --add-module=/usr/local/src/headers-more-nginx-module --add-module=/usr/local/src/memc-nginx-module --add-module=/usr/local/src/ngx_devel_kit --add-module=/usr/local/src/ngx_brotli --add-module=/usr/local/src/echo-nginx-module --add-module=/usr/local/src/ngx_http_substitutions_filter_module --add-module=/usr/local/src/redis2-nginx-module --add-module=/usr/local/src/srcache-nginx-module --add-module=/usr/local/src/set-misc-nginx-module --add-module=/usr/local/src/ngx_http_redis --add-module=/usr/local/src/ngx_http_auth_pam_module --add-module=/usr/local/src/nginx-module-vts --add-module=/usr/local/src/ipscrubtmp/ipscrub --add-module=/usr/local/src/incubator-pagespeed-ngx-latest-stable --with-openssl=/usr/local/src/openssl --with-openssl-opt='enable-ec_nistp_64_gcc_128 enable-tls1_3' --with-zlib=/usr/local/src/zlib --sbin-path=/usr/sbin/nginx

Hello,
Nginx-ee build include nginx_http_redis & redis2-nginx modules, so it's possible to use redis directly with Nginx instead of fastcgi_cache.
Inside a standard nginx vhost (without plesk) it will look like :

Code:
server { 
 
- - - 

location /redis-fetch {
    internal  ;
    set  $redis_key $args;
    redis_pass  redis;
}
location /redis-store {
    internal  ;
    set_unescape_uri $key $arg_key ;
    redis2_query  set $key $echo_request_body;
    redis2_query expire $key 14400;
    redis2_pass  redis;
}

location ~ \.php$ {
  set $key "nginx-cache:$scheme$request_method$host$request_uri";
  try_files $uri =404;

  srcache_fetch_skip $skip_cache;
  srcache_store_skip $skip_cache;

  srcache_response_cache_control off;

  set_escape_uri $escaped_key $key;

  srcache_fetch GET /redis-fetch $key;
  srcache_store PUT /redis-store key=$escaped_key;

  more_set_headers 'X-SRCache-Fetch-Status $srcache_fetch_status';
  more_set_headers 'X-SRCache-Store-Status $srcache_store_status';

  include fastcgi_params; 
  fastcgi_pass php72;
}

But with Plesk it will require to edit Plesk virtualhost templates. You can find more informations in the Plesk documentation : A WordPress website on a Plesk server shows "404 Not Found" on all pages except index.php, when running on FPM by nginx
I'm already working on a custom template with Nginx fastcgi_cache available on Github : VirtuBox/plesk-nginx-fascgi-cache-template
But it's not fully ready for production (cache is shared between all subscription, there is no isolation at the moment).
 
thanks @virtubox for this quick Demo :)

Did you maybe do a performance test with siege? I can not tell the difference on my test system (Wordpress+WooCommerce)


Code:
 siege -c50 -d10 -t3M https://**********.eu
Standard Settings php7.2 fpm with apache2.4 and Nginx Cache
Transactions:                   1816 hits
Availability:                 100.00 %
Elapsed time:                 179.75 secs
Data transferred:             130.58 MB
Response time:                  0.01 secs
Transaction rate:              10.10 trans/sec
Throughput:                     0.73 MB/sec
Concurrency:                    0.09
Successful transactions:        1816
Failed transactions:               0
Longest transaction:            0.70
Shortest transaction:           0.00

Nginx php7.2 fast-cgi
Transactions:                   1347 hits
Availability:                 100.00 %
Elapsed time:                 179.42 secs
Data transferred:             106.27 MB
Response time:                  1.61 secs
Transaction rate:               7.51 trans/sec
Throughput:                     0.59 MB/sec
Concurrency:                   12.08
Successful transactions:        1347
Failed transactions:               0
Longest transaction:            4.66
Shortest transaction:           0.23

I did not try nginx with redis cache, I'm hoping for a real performance.
how can i test if nginx with redis is working properly?

thanks in advance
Manuel
 
Hello, I have written a small tutorial to explain how to setup redis-server and use it as object cache backend for WordPress on a Plesk Onyx server.

To setup Redis, two solutions available : local install or inside a docker container

Solution 1) Local Installation of Redis-server ( debian 8 Jessie )

You can install redis-server easily with the package available on the dotdeb.org repository.
I have create a simple bash script to install redis :
Code:
bash <(wget --no-check-certificate -O - https://git.virtubox.net/virtubox/plesk-script/raw/master/redis-cache.sh)
But you can install redis manually, by adding the main repository to your sources.list

Code:
echo 'deb http://packages.dotdeb.org jessie all' > /etc/apt/sources.list.d/dotdeb.list
wget https://www.dotdeb.org/dotdeb.gpg
apt-key add dotdeb.gpg

And install redis-server :
Code:
apt-get update && apt-get upgrade -y
apt-get install redis-server -y

Then start the redis-server service :
Code:
service redis-server start


Solution 2) Run Redis inside a docker container

You can create your container from the Plesk docker manager :
I have used the bitnami/redis image, and the following settings :

Screenshot_98.png


You can also create your container directly from the command line :

Code:
docker run \
   -e REDIS_PASSWORD=redispassword \
   -v /var/redis:/bitnami \
   -p 6379:6379 \
   bitnami/redis:latest


Configure Redis-object-cache plugin in WordPress

Our redis-server is now running properly, so you can install the plugin redis-object-cache using the wordpress plugin manager. Before enabling object-cache, you have to add following line in your wp-config.php file :

Code:
define( 'WP_CACHE_KEY_SALT', 'yoursitename:' );
It will add a prefix to all cache keys stored in redis, and allow you to use object-cache for multiple wordpress instances on the same server.
If you have set a password to secure redis, you will also have to add the following line in your wp-config.php file :

Code:
define( 'WP_REDIS_PASSWORD', 'redispassword' );
Then, you can enable object-cache in the plugin settings page :




Tutorial available on : Improve WordPress loading speed with Redis on Plesk Onyx - VirtuBox

Feel free to tell me if you have any suggestion to improve my guide .

Hello @virtubox,

When I run the cmd, I have this error:
mkdir: cannot create directory '/bitnami/redis': Permission denied

Can you help ?
 
Back
Top