通过 ebextentions 设置 laravel 存储目录权限
Setting a laravel storage directory permission by ebextentions
我正在研究弹性 beanstalk 扩展。每次部署都会发生存储权限被拒绝的错误,我必须键入命令来解决该错误。下面的代码(.extensions/chmod.config)是否可以防止错误发生?
container_commands:
01addpermission:
command: "chmod -R 755 /var/app/current/storage"
01clearcache:
command: "php /var/app/current config:cache"
遗憾的是,代码将无法运行。原因是 container commands 运行 当您的应用程序在 staging
文件夹中时, 不 在 current
文件夹中:
The specified commands run as the root user, and are processed in alphabetical order by name. Container commands are run from the staging directory, where your source code is extracted prior to being deployed to the application server.
你可以尝试使用相对路径:
container_commands:
01addpermission:
command: "chmod -R 755 ./storage"
02clearcache:
command: "php . config:cache"
备选方案 是使用 postdeploy 平台挂钩,在部署应用后 运行s 命令:
Files here run after the Elastic Beanstalk platform engine deploys the application and proxy server
我正在研究弹性 beanstalk 扩展。每次部署都会发生存储权限被拒绝的错误,我必须键入命令来解决该错误。下面的代码(.extensions/chmod.config)是否可以防止错误发生?
container_commands:
01addpermission:
command: "chmod -R 755 /var/app/current/storage"
01clearcache:
command: "php /var/app/current config:cache"
遗憾的是,代码将无法运行。原因是 container commands 运行 当您的应用程序在 staging
文件夹中时, 不 在 current
文件夹中:
The specified commands run as the root user, and are processed in alphabetical order by name. Container commands are run from the staging directory, where your source code is extracted prior to being deployed to the application server.
你可以尝试使用相对路径:
container_commands:
01addpermission:
command: "chmod -R 755 ./storage"
02clearcache:
command: "php . config:cache"
备选方案 是使用 postdeploy 平台挂钩,在部署应用后 运行s 命令:
Files here run after the Elastic Beanstalk platform engine deploys the application and proxy server