1)在项目的.env文件中添加如下一行:
RESPONSE_CACHE_ENABLED=true
2)拷贝 laravel-worker.conf.example,将laravel字段替换为域名,并执行正确的项目路径/var/www/slbfwm/artisan
1 leyao-slb01 php-worker # cd /srv/leyao/docker/php-worker/supervisord.d/ 2 leyao-slb01 supervisord.d # ls 3 laravel-scheduler.conf.example laravel-worker.conf.example slbfwm.worker.conf 4 leyao-slb01 supervisord.d # cp laravel-worker.conf.example slbfwm.worker.conf
1 leyao-slb01 supervisord.d # cat laravel-worker.conf.example 2 [program:laravel-scheduler] 3 process_name=%(program_name)s_%(process_num)02d 4 command=/bin/sh -c "while [ true ]; do (php /var/www/artisan schedule:run --verbose --no-interaction &); sleep 60; done" 5 autostart=true 6 autorestart=true 7 numprocs=1 8 user=laradock 9 redirect_stderr=true 10 11 [program:laravel-default-worker] 12 process_name=%(program_name)s_%(process_num)02d 13 command=php /var/www/artisan queue:work redis --queue=default --sleep=3 --tries=3 --daemon 14 autostart=true 15 autorestart=true 16 numprocs=2 17 user=laradock 18 redirect_stderr=true 19 20 [program:laravel-member-worker] 21 process_name=%(program_name)s_%(process_num)02d 22 command=php /var/www/artisan queue:work redis --queue=member --sleep=3 --tries=3 --daemon 23 autostart=true 24 autorestart=true 25 numprocs=4 26 user=laradock 27 redirect_stderr=true 28 leyao-slb01 supervisord.d # 29 leyao-slb01 supervisord.d # 30 leyao-slb01 supervisord.d # cat slbfwm.worker.conf 31 #[program:slbfwm-scheduler] 32 #process_name=%(program_name)s_%(process_num)02d 33 #command=/bin/sh -c "while [ true ]; do (php /var/www/artisan schedule:run --verbose --no-interaction &); sleep 60; done" 34 #autostart=true 35 #autorestart=true 36 #numprocs=1 37 #user=laradock 38 #redirect_stderr=true 39 40 [program:slbfwm-default-worker] 41 process_name=%(program_name)s_%(process_num)02d 42 command=php /var/www/slbfwm/artisan queue:work redis --queue=default --sleep=3 --tries=3 --daemon 43 autostart=true 44 autorestart=true 45 numprocs=2 46 user=laradock 47 redirect_stderr=true 48 49 #[program:laravel-member-worker] 50 #process_name=%(program_name)s_%(process_num)02d 51 #command=php /var/www/artisan queue:work redis --queue=member --sleep=3 --tries=3 --daemon 52 #autostart=true 53 #autorestart=true 54 #numprocs=4 55 #user=laradock 56 #redirect_stderr=true 57 leyao-slb01 supervisord.d #
3)重启php-worker容器
leyao-slb01 docker # docker-compose restart php-worker
4)修改当天日志文件的数组及权限
leyao-slb01 logs # chown root:root laravel-2019-06-26.log leyao-slb01 logs # chmod 777 laravel-2019-06-26.log
5)编辑 UnderStore.php 文件
leyao-slb01 slbfwm # vim /srv/leyao/slbfwmapp/Http/Middleware/UnderStore.php
## 删除倒数第二行,如下
->onQueue('cache-process')