Categories: Learn Laravel Tutorials, Tips And Guides

How to Setup Laravel Application on Cloudways With Redis Cache

Reading Time: 3 minutes

Laravel provides a number of cache drivers like a database, Memcached, and Redis. Out of these options, Redis Cache for Laravel is the best because it is different from Memcached in the sense that it has persistence. Further advantages of Redis over Memcached are that it works with more data types, and it uses less memory.

Cloudways offers Laravel on its Managed Cloud Web Hosting Platform. I’m writing this blog post to help you set up Redis Cache in Laravel in a jiffy!

Let’s begin.

Setting up Laravel Application on Cloudways

Signup at Cloudways; Select Laravel 5.5 as your application; Fill in your application and server name and launch the server. Your new Laravel 5.5 application will be launched within minutes, as shown in the GIF below.

Enable Redis on Cloudways Server.

I assume that you are signed into your Cloudways account. Follow these steps:

  1. Select Server Management tab
  2. Go to Server Settings & Packages tab
  3. Press the Packages button and turn on Redis by clicking the Install button

In a few moments, Redis is installed and enabled on your Cloudways server.

Setting up Redis on Laravel

Now that the Redis is installed and enabled on your server, let’s set it up on your Laravel 5.5 application. For this, follow these steps

  1. Go to the Application Management tab.
  2. Get your application’s SSH terminal and start a SSH session using the provided SSH credentials.
  3. Now to make sure that Redis is working, type the following command:
    redis-cli ping

    If you get PONG in response, Redis is enabled on your server.

  4. Before using Redis with Laravel, you will need to install the predis/predis package (~1.0) via Composer. To do that, type the following command in terminal
    composer require predis/predis

  5. The Redis configuration for your application is located in the config/database.php file
    'redis' => [
       'client' => 'predis',
       'default' => [
           'host' => env('REDIS_HOST', 'localhost'),
           'password' => env('REDIS_PASSWORD', null),
           'port' => env('REDIS_PORT', 6379),
           'database' => 0,

    In the config/cache.php file, you can change your default cache driver from file to Redis, and start using Redis in your application.


You’re done! I hope this post was helpful for those who want to activate Laravel app along with Redis cache on Cloudways Cloud Console. If you have any question, feel free to ask in the comments section below. To check out the features offered by Cloudways for Laravel users, visit this page.

Ayaz Ahmed Khan :Ayaz Ahmed Khan works as Senior Research and Development Engineer at Cloudways.