Laravel system can have various permission denied errors when running in production server.
php artisan cache:clear
If you get error to clear cache, exeucte command using sudo
.
sudo php artisan cache:clear
sudo find . -type f -exec chmod 664 {}; sudo find . -type d -exec chmod 775 {}; sudo chgrp -R www-data storage bootstrap/cache sudo chmod -R ug+rwx storage bootstrap/cache
When you running Laravel queue by supervisor, specify www-data
user.
Set user in your supervisor configuration file. (ex. /etc/supervisor/conf.d/larvel-worker.conf)
[program:laravel-worker] process_name=%(program_name)s_%(process_num)02d command=php /var/www/my-app/artisan queue:work --timeout=300 autostart=true autorestart=true stopasgroup=true killasgroup=true user=www-data numprocs=1 redirect_stderr=true stdout_logfile=/var/www/my-app/worker.log stopwaitsecs=300
Generally, laravel scheduler runs by cron job. You need to specify user which can access in your laravel application folder.
* * * * * www-data php /var/www/my-app/artisan schedule:run >> /dev/null 2>&1
You can access your web application with custom domain.