Caching allows us to store data in RAM so that any future request for that data can be served faster, without any needing to query the database or process any PHP. In this tutorial, we will install a Redis server as an object cache for DB queries, and configure WordPress to use it.
Now we need to configure our Redis cache policy, we will set the maximum memory available to it for caching and also the eviction policy for when the cache memory becomes full and we need to replace old data with new data.
Open the Redis configuration file with your favorite text editor:
sudo nano /etc/redis/redis.conf
Now you need to uncomment the line '# maxmemory' and set your desired value, underneath this we will set the eviction policy, like so:
maxmemory 128mb
maxmemory-policy allkeys-lfu
Your conf file should look like this:
Remember to save the configuration file changes and restart both Redis and PHP-FPM:
sudo service redis-server restart
sudo service php7.0-fpm restart
If you have updated your php installation to php7.1 or php7.2 remember to make the appropriate changes.
Next we need to edit our WordPress 'wp-config.php' file to add a cache key salt with the name of your site, and define 'WP_CACHE' as true to create a persistent cache with the WordPress Redis Object cache plugin we will install later:
Open your 'wp-config.php' file for editing:
sudo nano /var/www/html/wp-config.php
Immediately after the WordPress unique Keys and Salts section, add the following with your site's url:
define( 'WP_CACHE_KEY_SALT', 'an-example-domain.com' );
define( 'WP_CACHE', true );
Your config file should now look like this:
We need to install a Redis Object Cache plugin in order for WordPress to make use of Redis as an object cache, there are several in the WordPress plugin repository, but we will use the Redis Object Cache plugin by Till Krüss.
Once the plugin is installed, go to the plugins settings and enable the object cache. If everything has been configured correctly, you should see a settings screen like this:
If you want to flush the Redis cache, you can do it from this screen. And if you would like to look at the details, you can go to WordPress: Performance Benchmarking & Installing Redis Object Caching.
In this tutorial, we will install and configure LibreNMS on Ubuntu 16.04 with an Alibaba Cloud Elastic Compute Service (ECS) instance.
LibreNMS runs on the web server, written in PHP and uses MariaDB for database. So you will need to install Apache, PHP and MariaDB to your system.
There are many PHP based Content Management Systems (CMS) that you can run on an Alibaba Cloud ECS Instance with a LEMP stack. Of these, Craft CMS is probably one of the slickest.
As Craft is built using the Yii high performance PHP framework, and adheres to modern PHP standards, it is also a very scalable and stable platform.
Integrated with one of the world’s most popular web publishing platforms for building blogs and websites. We, IGS, provide a list of images pre-integrated with most popular software for web solution. It includes ready-to-run versions of Apache/Nginx, MySQL, PHP, phpMyAdmin and all of the other software required to run each of those components. IGS image greatly simplifies the development and deployment of web applications.
If you have a PHP Memcache environment, pay attention to the prompts during the tutorial to avoid overwriting the production environment, which may render the business unavailable. We recommend that you back up the data before upgrading or compiling the environment.
Security Center is available in Basic Edition and Enterprise Edition.
Webshell detection: checks both instances/servers and networks for web scripts, such as PHP, ASP, and JSP files.
Suspicious database commands: Suspicious commands in databases, such as MySQL, PostgreSQL, SQLServer, Redis, and Oracle.
ApsaraDB for Redis is an automated and scalable tool for developers to manage data storage shared across multiple processes, applications or servers.
ApsaraDB for Redis supports advanced data structures, which are not readily achievable through databases such as leaderboard, counting, session, and tracking.
ApsaraDB for Memcache is a managed memory based caching service, which supports high-speed access to queries and data. ApsaraDB for Memcache improves the response of dynamic websites or applications by relieving the load on the backend database as cache data is stored in-memory.
The objective of this course is to learn the core services of Alibaba Cloud's Elastic Architecture: Auto-Scaling, CDN, Redis, and Memcache by studying some use cases.
Knowledge sharing - Introduction to the Spring Cloud Bus message bus
2,599 posts | 762 followers
FollowAlibaba Clouder - January 2, 2018
Alibaba Clouder - August 15, 2018
Alibaba Clouder - May 20, 2019
Alibaba Clouder - January 3, 2018
ApsaraDB - August 30, 2021
Alibaba Clouder - July 8, 2020
2,599 posts | 762 followers
FollowAn encrypted and secure cloud storage service which stores, processes and accesses massive amounts of data from anywhere in the world
Learn MoreMore Posts by Alibaba Clouder