laravel 5.6

.env

1
2
APP_ENV=production
APP_DEBUG=false

mix

1
npm run prod

artisan

1
2
3
4
5
6
7
8
9
10
11
12
php artisan key:generate

php artisan route:clear
php artisan route:cache

php artisan config:clear
php artisan config:cache

php artisan view:clear
php artisan view:cache

php artisan storage:link

crontab

1
* * * * * /usr/local/php/bin/php /data/wwwroot/jingle_school/artisan schedule:run >> /dev/null 2>&1

supervisor

use supervisor

queues

1
2
3
4
5
6
7
8
[program:jingle_school_horizon]
process_name=%(program_name)s
command=/usr/local/php/bin/php /data/wwwroot/jingle_school/artisan horizon
autostart=true
autorestart=true
user=www
redirect_stderr=true
stdout_logfile=/data/supervisor/jingle_school_horizon.log

broadcasting

use laravel-echo

1
2
3
4
5
6
7
8
9
10
[program:jingle_school_echo]
process_name=%(program_name)s
environment=PATH="/usr/local/node/bin/"
directory=/data/wwwroot/jingle_school/
command=/usr/local/node/bin/laravel-echo-server start
autostart=true
autorestart=true
user=www
redirect_stderr=true
stdout_logfile=/data/supervisor/jingle_school_echo.log

nginx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
server {

……

location /socket.io/ {
proxy_pass http://127.0.0.1:6001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}

……

}

other

.env APP_ENV 参数

https://segmentfault.com/q/1010000010638443/a-1020000010644794

  1. 开发: local
  2. 测试: testing
  3. 预上线: staging
  4. 正式环境: production

关于线上 queues 不运行

检查下 .env APP_ENV 是否为 production

然后 再看 报错 这类