Troubleshooting
Purpose
This page documents common technical issues, diagnostic commands, and standard resolution steps for Maqsafy services.
Troubleshooting Rules
- Do not include real passwords.
- Do not include access tokens.
- Do not include private keys.
- Do not include customer personal data.
- Remove sensitive data from logs before documenting.
- Document only confirmed root causes.
- Use placeholders for domains, IPs, credentials, and user identifiers.
Troubleshooting Template
Use this structure for every issue:
| Field | Description |
|---|---|
| Issue | Short issue description |
| Symptoms | What the user or system shows |
| Possible Cause | Technical root cause |
| Diagnostic Commands | Commands used for investigation |
| Resolution | Fix steps |
| Verification | How to confirm the issue is resolved |
Issue: 502 Bad Gateway
Symptoms
- Browser displays
502 Bad Gateway. - Nginx cannot reach the upstream service.
- The application container or service may be stopped.
Diagnostic Commands
docker ps
docker logs <container-name>
sudo nginx -t
sudo tail -f /var/log/nginx/error.log
Possible Causes
- Backend container is down.
- Nginx upstream points to the wrong port.
- Container is not attached to the expected Docker network.
- Application service is running but unhealthy.
Resolution
- Confirm containers are running.
- Check backend logs.
- Validate Nginx configuration.
- Confirm upstream host and port.
- Restart the affected service if required.
Verification
curl -I https://example.com
curl https://example.com/health
Issue: 500 Internal Server Error
Symptoms
- Browser or API returns
500 Internal Server Error. - Application logs show unhandled exceptions.
Diagnostic Commands
tail -f storage/logs/laravel.log
php artisan about
php artisan config:clear
php artisan cache:clear
Possible Causes
- Invalid environment configuration.
- Missing application key.
- Database connection error.
- Code exception.
- Permission issue in storage or cache directories.
Resolution
- Review the Laravel log.
- Check environment variables.
- Clear and rebuild Laravel caches.
- Confirm database connectivity.
- Fix the underlying application exception.
Verification
curl -I https://example.com
Issue: Queue Workers Not Processing Jobs
Symptoms
- Background jobs are delayed.
- Notifications, exports, or scheduled actions are not processed.
- Jobs remain in queue.
Diagnostic Commands
php artisan queue:failed
php artisan queue:work
php artisan queue:restart
Possible Causes
- Queue worker is stopped.
- Redis is not reachable.
- Queue connection is misconfigured.
- Failed jobs are accumulating.
- Supervisor process is not running.
Resolution
- Confirm queue driver configuration.
- Check Redis or database queue connectivity.
- Restart queue workers.
- Review failed jobs.
- Restart process manager if used.
Verification
- Submit a test background job.
- Confirm it is processed.
- Confirm no new failed jobs are created.
Issue: Redis Connection Error
Symptoms
- Application cannot connect to Redis.
- Queue, cache, or session operations fail.
- Logs show Redis host or DNS resolution errors.
Diagnostic Commands
docker ps
docker logs <redis-container>
docker network ls
docker network inspect <network-name>
Possible Causes
- Redis container is stopped.
- Redis hostname is incorrect.
- Application container is not on the same Docker network.
- Redis port or credentials are misconfigured.
Resolution
- Confirm Redis is running.
- Confirm the Redis host value.
- Confirm containers are on the same Docker network.
- Restart dependent application services.
Verification
- Confirm cache works.
- Confirm queue workers process jobs.
- Confirm logs no longer show Redis connection errors.
Issue: Database Connection Error
Symptoms
- Application returns database-related errors.
- Login or dashboard data loading fails.
- Logs show connection refused, access denied, or unknown database.
Diagnostic Commands
php artisan tinker
php artisan migrate:status
mysql -h <db-host> -u <db-user> -p
Possible Causes
- Incorrect database host.
- Incorrect database username or password.
- Database server is down.
- Firewall or network restriction.
- Missing database schema.
Resolution
- Confirm database service is running.
- Confirm
.envdatabase values. - Confirm user permissions.
- Confirm network access from the application server.
- Confirm migrations status.
Verification
- Login works.
- Dashboard pages load data.
- Logs show no new database connection errors.
Issue: Slow Dashboard or Reports
Symptoms
- Dashboard pages load slowly.
- Reports or exports take too long.
- Database CPU or I/O usage is high.
Diagnostic Commands
EXPLAIN SELECT * FROM orders WHERE student_id = 1;
top
htop
docker stats
Possible Causes
- Missing indexes.
- Large table scans.
- Heavy report queries.
- Exports running during peak time.
- Queue jobs competing with live traffic.
Resolution
- Identify slow queries.
- Review indexes.
- Move heavy exports to background jobs.
- Schedule heavy reports outside peak hours.
- Add pagination or filtering where required.
Verification
- Page response time improves.
- Database load decreases.
- Reports complete within expected time.
Issue: Nginx Configuration Error
Symptoms
- Site does not reload after Nginx changes.
- Nginx reports invalid configuration.
- Some routes return unexpected errors.
Diagnostic Commands
sudo nginx -t
sudo systemctl status nginx
sudo tail -f /var/log/nginx/error.log
Possible Causes
- Invalid syntax in Nginx configuration.
- Wrong upstream port.
- Missing SSL certificate path.
- Conflicting server blocks.
Resolution
- Run
sudo nginx -t. - Fix the reported configuration line.
- Reload Nginx only after validation passes.
sudo systemctl reload nginx
Verification
curl -I https://example.com
Issue: Login Failure
Symptoms
- User cannot log in.
- API returns unauthorized or validation error.
- Authentication logs show failed attempts.
Diagnostic Commands
tail -f storage/logs/laravel.log
Possible Causes
- Incorrect credentials.
- Inactive user account.
- Missing role or scope.
- OTP provider issue.
- Rate limiting or brute-force protection triggered.
Resolution
- Confirm user account status.
- Confirm role and permission scope.
- Check OTP/SMS provider logs if applicable.
- Check rate-limit status.
- Reset access if approved.
Verification
- User can log in.
- Correct dashboard permissions are applied.
- Authentication log is recorded.
Issue Log Format
When documenting a resolved issue, use this format:
## YYYY-MM-DD - Issue Title
| Field | Details |
|---|---|
| Environment | Production / Staging / Local |
| Impact | Low / Medium / High |
| Root Cause | Confirmed cause |
| Resolution | Fix applied |
| Verification | How it was confirmed |
| Owner | Responsible person/team |