窗户:部署到Amazon青​​苗之前设置PHP文件权限 [英] Windows: Setting PHP file permissions before deploying to Amazon Beanstalk

查看:218
本文介绍了窗户:部署到Amazon青​​苗之前设置PHP文件权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近转换到Amazon的弹性青苗这一直是伟大的,但我有一个问题,我一直无法修复或找到一个体面的解决方案。

I've recently converted over to Amazon's Elastic Beanstalk which has been great but I have one problem I haven't been able to fix or find a decent solution to.

在通过GIT与部署
    $ git的aws.push

When deploying via GIT with $ git aws.push

我的文件部署,但我的所有文件夹和文件不具有正确的权限。当前正在运行的运8 XAMPP的地方发展。例如在最近的一个字preSS部署,一旦部署到beanstlak我所有的文件夹都是777。这是一个NTFS分区中的文件都在了。

My files are deployed but all my folders and files do not have the correct permissions. Currently running Win 8 with xampp for local development. For example on a recent WordPress deployment, all my folders were 777 once deployed to beanstlak. It is an NTFS partition the files are in too.

这是很容易够SSH并运行:

It is easy enough to SSH in and run:

$  sudo su
$  find /var/www/html/ -type d -exec chmod 755 {} \;
$  find /var/www/html/ -type f -exec chmod 644 {} \;

不过,我宁愿修复我的权限之前上传的,但是我不认为这是可能与Windows。我敢肯定,我可以安装一个脚本或某些类型的服务钩上部署运行这些,但我希望有可能是一个更简单的方法。

However I'd rather fix my permissions before upload however I don't think this is possible with Windows. I'm sure I can setup a script or some type of service hook to run these on deployment but I was hoping there may be an easier way.

从SO社区上设置Windows文件的权限来匹配Apache的任何有识之士?

Any insight from the SO community on setting windows file permissions to match Apache's?

推荐答案

这其实并不难设置一个钩子上code被提取到您的实例(S)后修正权限,但它被认为是前部署。您可以创建一个名为 .ebextensions / 00permissions.conifg 文件,名称,只要它是在正确的文件夹中扩展名为并不重要。配置 - 的配置脚本执行按字母顺序排列。内容将是这样:

It's actually not that hard to setup a hook to fix the permissions after your code is extracted onto your instance(s) but before it is considered "deployed". You could create a file called .ebextensions/00permissions.conifg, the name isn't important as long as it's in the right folder with the extension .config - the config scripts execute in alphabetical order. The contents would be like:

container_commands:
  00fix_permissions_dirs:
    command: "find . -type d -exec chmod 755 {} \;"
    ignoreErrors: true
  01fix_permissions_files:
    command: "find . -type f -exec chmod 644 {} \;"
    ignoreErrors: true

请注意默认目录 container_command 是部署文件解压的目录,因此无需设置明确的路径。

Note the default directory for a container_command is the directory the deploy files have been extracted to, so no need to set an explicit path.

您可以看到有关各种命令,你可以运行更多信息您实例的弹性青苗文档中

You can see more info about the kinds of commands you can run on your instances in the Elastic Beanstalk documentation.

这篇关于窗户:部署到Amazon青​​苗之前设置PHP文件权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆