Laravel 项目部署注意事项

安装第三方组件

注意: 可以自定义 compose 镜像,加快拉取速度

$ compose update
目录结构及权限
  • 配置 .env 文件,数据库、redis 等,.env.example 文件在提交版本库时,必须与 .env 文件的所有配置项保持高度一致
$ cp .env.example .env
  • 创建目录,git clone 从仓库拉取的代码,可能会存在 storage 目录缺失的问题,需要手动创建
$ mkdir -p storage/{app,debugbar,framework,logs}
$ mkdir -p storage/framework/{cache,sessions,testing,views}
  • 修改权限,必须保证 storagebootstarp/cache 有读写权限
$ chmod 777 -R storage bootstrap/cache
创建 storagepublic 的软链接
$ php artisan storage:link
创建 KEY
$ php artisan key:generate
创建 JWT 密钥

注意: 此步为非必须,如有使用 JWT 接口则需要执行

$ php artisan jwt:secret

你可能感兴趣的:(Laravel 项目部署注意事项)