The process of installing the supervisor will depend on the version of the OS on which your server is running. You can find out your OS by following the tips on this page .
In any case, you will need SSH access to run commands in terminal privileges and sudo / root.
Here is the schematic for Debian / Ubuntu OS.
1 / Install beanstalkd
Install beanstalkd (the daemon that will process the queues):
(note: you can skip this step if instead you are going to use some simple queue driver, for example "sync" or "database" - in this case, be sure to replace "beanstalkd" later in this manual, namely in the configuration file section supervisor)
sudo apt-get install beanstalkd sudo nano /etc/default/beanstalkd
uncomment this line:
START=yes
start the service:
sudo service beanstalkd start
2 / Add Pheanstalk Package
In your Laravel application, add the Pheanstalk package to talk to beanstalkd:
(skip this step if you are not using the beanstalkd driver)
cd /my/laravel/app/dir composer require pda/pheanstalk
3 / Install dispatcher
sudo apt-get install supervisor
make sure it starts from the server
sudo service supervisor restart
Create a supervisor configuration file for your laravel application
sudo nano /etc/supervisor/conf.d/myapp.conf
Here's an example file, it will start 2 threads that will listen on your queue. Each task will be checked a maximum of 3 times before failing. Remember to change the user and paths according to your laravel directory and server user.
[program:laravel-worker] process_name=%(program_name)s_%(process_num)02d command=php /my/laravel/app/dir/artisan queue:work beanstalkd --tries=3 autostart=true autorestart=true user=forge numprocs=2 redirect_stderr=true stdout_logfile=/my/laravel/app/dir/storage/logs/worker.log
See https://laravel.com/docs/master/queues#running-the-queue-worker for more information on the other options that you can configure here.
4 / Make sure changes change
sudo supervisorctl reread sudo supervisorctl update sudo supervisorctl restart laravel-worker:*
5 / To do this, try sending the task to the default queue, check your laravel log for errors.