繁体   English   中英

AWS Elastic Beanstalk 如何将.ebextensions 写入/etc/httpd/conf.d/ 里面的conf 文件?

[英]AWS Elastic Beanstalk how to get.ebextensions to write to /etc/httpd/conf.d/ the conf files inside?

在部署 Elastic Beanstalk 应用程序期间,尝试将 .conf 文件从 Elastic beanstalk 添加到 E2 实例上的 /etc/httpd/conf.d/ 目录。 我在 .ebextensions 目录中添加了一个 .config 文件,其定义如下:

files:
  "/etc/php.d/project.ini" :
    mode: "000644"
    owner: root
    group: root
    content: |
      max_input_vars = 10000
      upload_max_filesize = 256M
      post_max_size = 256M

container_commands:
  01_enable_mod_deflate:
    command: "cp .ebextensions/enable_mod_deflate.conf /etc/httpd/conf.d/enable_mod_deflate.conf"
  02_enable_mod_expires:
    command: "cp .ebextensions/enable_mod_expires.conf /etc/httpd/conf.d/enable_mod_expires.conf"
  03_secure_wordpress:
    command: "cp .ebextensions/secure_wordpress.conf /etc/httpd/conf.d/secure_wordpress.conf"
  04_restart_apache:
    command: "sudo apachectl restart"

.conf 文件都在 .ebextensions 文件夹中,但它们没有被复制,这导致 wordpress 站点根目录中的 .htaccess 出现问题。 正在生成的错误如下所示:

命令 01_enable_mod_deflate (cp /var/app/current/.ebextensions/enable_mod_deflate.conf /etc/httpd/conf.d/enable_mod_deflate.conf) 失败 2020-10-05 13:45:59,944 [ERROR] 构建 postbuild_0_Bridge2fits 时遇到错误:命令 01_enable_mod_deflate 失败回溯(最近一次调用):文件“/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py”,第 542 行,在 run_config CloudFormationCarpenter(config, self._auth_config).build(工作日志)文件“/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py”,第260行,在构建更改['commands'] = CommandTool().apply(self._config.commands)文件“ /usr/lib/python2.7/site-packages/cfnbootstrap/command_tool.py", line 117, in apply raise ToolError(u"Command %s failed" % name) ToolError: Command 01_enable_mod_deflate failed

不确定这意味着什么,但它为每个文件生成相同的错误。 这里有什么问题? 我刚刚启动了一个新的 Elastic Beanstalk 实例,默认情况下这不应该工作吗? 实例有问题还是什么? 由于根目录中的 .htaccess 文件,该站点正在生成 500 错误,但如果我将其删除,则只有主页加载,所有其他页面都会出现 404 错误。 我需要将这些 .conf 文件添加到所有实例的 /etc/httpd/conf.d/ 目录中,但由于上述错误,它们根本没有添加到任何实例中,我不知道如何修复,或者这是否是使用 Elastic Beanstalk 创建的默认实例的问题?

如何解决这个问题? 我已经重新启动了环境,但这没有帮助。 我对重建环境有点犹豫,因为这会清除连接到应用程序的数据库,并且不确定这是否有帮助。

您可能正在使用 Amazon Linux 2,它更改了代理(NGINX 或 Apache)的配置文件的位置。 将您的代理配置文件放在.platform而不是.ebextensions 下:例如:

|____wp-signup.php
|____.platform
| |____httpd
| | |____conf.d
| | | |____http-redirect.conf

文档中的更多详细信息:

将您的 Elastic Beanstalk Linux 应用程序迁移到 Amazon Linux 2

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM