there is object-cache.php in wp-content folder, i am using WP fastest Cache an auto-optimize.
How do I see Redis RAM usage by Bitnami/redis docker image
:/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
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;
}
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
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 :
But you can install redis manually, by adding the main repository to your sources.listCode:bash <(wget --no-check-certificate -O - https://git.virtubox.net/virtubox/plesk-script/raw/master/redis-cache.sh)
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 :
![]()
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 :
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.Code:define( 'WP_CACHE_KEY_SALT', 'yoursitename:' );
If you have set a password to secure redis, you will also have to add the following line in your wp-config.php file :
Then, you can enable object-cache in the plugin settings page :Code:define( 'WP_REDIS_PASSWORD', 'redispassword' );
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 .