Introducing Our New Per-User Redis Addon for cPanel: Boost Your Website's Performance Today!Author: InfinyHost · Published at: Mar 31, 2023
Supercharge your web applications with our latest Redis addon
We are excited to announce the launch of our new per-user Redis addon for cPanel-based shared hosting! This addon has been specifically designed to provide an easy and seamless way for our customers to enable a separate Redis service instance right from their control panel.
Redis is an open-source, in-memory data structure store that can be used as a database, cache, and message broker. You can significantly improve your web applications' performance and response time by using Redis.
In this blog post, we will discuss the benefits of our Redis addon and provide examples of how to implement it in some of the most popular applications and add-ons, such as WordPress, both standalone and with LiteSpeed Cache plugin, standard PHP scripts, Laravel, and more.
Key Features of Our Redis Addon
Per-User Instance: Each customer gets their own Redis instance, ensuring better security and isolation between users.
Easy Setup: Enable Redis for your account with just a few clicks from your cPanel control panel. It takes less than 30 seconds to enable it.
Local Unix Socket: Our Redis addon uses a local Unix socket located in the user's home folder (at ~/.connectors/redis.sock), which ensures fast and secure connections. Unix sockets are much faster than traditional network connections, and since they are only accessible by your account scripts, there is no need to add an authentication layer or remember any usernames and passwords.
Shared Resources: Resources used by the Redis service are shared with the customer's LVE (Lightweight Virtual Environment), providing better resource management and performance.
How to Implement Our Redis Addon in Popular Apps and Addons
The general rule of thumb is that you would need to specify the path to the Redis socket only. All other settings, including port, user, and password, can and probably should be left blank for the connection to be successful.
WordPress with LiteSpeed Cache
To use our Redis addon with the LiteSpeed Cache plugin, follow these steps:
- Navigate to the LiteSpeed Cache settings in your WordPress admin dashboard.
- Go to the "Cache" tab, and then to the "Advanced" tab.
- Set "Cache Storage" to "Redis."
- Enter the following values for "Redis Host" and "Redis Port":
Redis Host: /home/your-cpanel-username/.connectors/redis.sockRedis Port: 0
Save the settings, and Redis will now be used for caching, automatically speeding up your website.
To use our Redis addon with your WordPress site without the LiteSpeed plugin, you will need to install the Redis Object Cache plugin. Follow these steps:
- Install and activate the Redis Object Cache plugin from the WordPress plugin repository.
- Add the following lines to your wp-config.php file:
define('WP_REDIS_SCHEME', 'unix'); define('WP_REDIS_PATH', '/home/yourusername/.connectors/redis.sock');
- Go to the plugin settings in your WordPress admin dashboard and click on "Enable Object Cache" to start using Redis.
To use our Redis addon with a Laravel application, follow these steps:
- Update your .env file with the following lines:
REDIS_HOST=/home/yourusername/.connectors/redis.sock REDIS_PORT= REDIS_SCHEME=unix
- In your config/database.php file, update the Redis configuration array as follows:
'redis' => [ 'client' => env('REDIS_CLIENT', 'phpredis'), 'default' => [ 'scheme' => env('REDIS_SCHEME', 'unix'), 'path' => env('REDIS_HOST', '/home/yourusername/.connectors/redis.sock') 'port' => env('REDIS_PORT', null), 'database' => env('REDIS_DATABASE', 0), ], ],
In any PHP application/code
To use our Redis addon in a standalone PHP application, you will need to install the PHP Redis extension for the selected version. To do so, log in to your cPanel control panel and navigate under the 'PHP Selector' page. Then, from the list of installed extensions, make sure Redis is checked in. Once installed, you can use the following code to connect to Redis:
$redis = new Redis(); $redis->connect('/home/yourusername/.connectors/redis.sock');
Our new per-user Redis addon for cPanel-based shared hosting offers a powerful way to enhance your website's performance and response times. With the easy integration process and compatibility with popular applications, there has never been a better time to give your website a performance boost.
Whether you're running a WordPress blog, an e-commerce site, or a custom web application, our Redis addon can make a significant difference in your site's performance. Try it today and experience the benefits for yourself!
If you have any questions or need assistance with implementing our Redis addon, feel free to reach out to our support team. We're here to help you every step of the way.