Using a Redis queue for multiple sites on one server

You can run a Redis queue to optimize performance in the Control Panel when using Spock. With a Redis Queue you can also push other tasks, like generating assets, into the background. This article explains how you can make a Redis queue work for multiple Statamic sites on one server.

Enable Redis queue

You can enable a Redis queue for your website by setting the following in your .env file:


For each site on your server, you want Redis to use it’s own database, or you’ll run into troubles. You can do this by adding the following to your .env file. Make sure you increase the database number for each site you’re running:


By default you have 16 Redis databases at hand.

Run a queue worker for each site

You need to run php please queue:listen for each site to activate the queue. If you use Forge you can easily configure a daemon for each of your sites. Configure this in the Daemon tab on the Server Details page of your server on Forge. Use the following configuration:

Command: php please queue:listen
User: forge
Directory: /home/forge/YOUR_SITE_NAME/

This makes sure the queue automatically starts after a reboot, failure, or a deploy. Happy queueing!

Last modified on May 13, 2019