🚀 Laravel on AWS: Queue Job Setup with Supervisor + Debugging Guide
In this post, we’ll learn how to:
- Deploy Laravel on an AWS server
- Set up queues using Supervisor
- Configure
worker.log
- Fix queue not working issues
- Debug and verify jobs
1️⃣ Laravel Project Setup on AWS EC2
2️⃣ Nginx Configuration
3️⃣ Laravel Queue Setup
4️⃣ Supervisor Setup for Laravel Workers
5️⃣ Common Issues & Fixes
Queue Not Processing?
Retry Failed Jobs
Permission Fix
6️⃣ References
- Laravel Queue Docs
- Supervisor Documentation
- Laravel Queue Not Processing – Stack Overflow
- Supervisor Setup Guide – Stack Overflow
💬 Need help with Horizon, Redis queues, or Docker deployment? Drop your issue in the comments below!
Option : 2
Path : /etc/supervisor/conf.d/laravel-worker.conf
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/Laravel-App/artisan queue:work --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
killasgroup=true
numprocs=8
redirect_stderr=true
stdout_logfile=/var/www/Laravel-App/worker.log
stopwaitsecs=3600
Error Tips:-
You change name
dispatch(new MyJob($data))->onQueue('emails');
Then add not working, then try to add the default
OPTION : 1(defolt)
command=/usr/bin/php /var/www/casino-backend-staging/artisan queue:work --queue=dsgplay,default --sleep=20 --tries=3 --timeout=120
🎯 Laravel Queue Worker Setup with Custom Supervisor Name
To set up Supervisor with a custom queue worker name in Laravel, follow these steps:
✅ 1. Create Supervisor Config File
sudo nano /etc/supervisor/conf.d/myqueue-worker.conf
Paste this into the file:
[program:myqueue-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/your-laravel-project/artisan queue:work --sleep=3 --tries=3 --timeout=90
autostart=true
autorestart=true
user=www-data
numprocs=1
redirect_stderr=true
stdout_logfile=/var/www/your-laravel-project/storage/logs/worker.log
stopasgroup=true
killasgroup=true
Replace /var/www/your-laravel-project
with your actual path.
✅ 2. Update Supervisor
sudo supervisorctl reread
sudo supervisorctl update
✅ 3. Start the Custom Worker
sudo supervisorctl start myqueue-worker:*
✅ 4. Check Status
sudo supervisorctl status
You should see something like:
myqueue-worker_00 RUNNING pid 12345, uptime 0:02:30
✅ 5. Laravel Queue Config
Ensure your .env
file has:
QUEUE_CONNECTION=database
🛠️ Change Queue Name in Laravel Jobs
✅ 1. When Dispatching Job
MyJob::dispatch($data)->onQueue('emails');
// or
dispatch(new MyJob($data))->onQueue('emails');
✅ 2. Manually Update Queue Name in Database
UPDATE jobs
SET queue = 'emails'
WHERE queue = 'default';
✅ 3. Worker Should Listen to Correct Queue
php artisan queue:work --queue=emails
For Supervisor config:
command=php /var/www/your-app/artisan queue:work --queue=emails --sleep=3 --tries=3 --timeout=90
🔁 Check Existing Jobs
SELECT * FROM jobs WHERE queue = 'default';
SELECT * FROM jobs WHERE queue = 'emails';
That's it! Your Laravel queue system is now customized and production-ready.