【问题标题】:Elastic Beanstalk - Ebextension config file not showing on ec2 instanceElastic Beanstalk - Ebextension 配置文件未显示在 ec2 实例上
【发布时间】:2022-02-03 17:18:50
【问题描述】:
files:
  "/home/ec2-user/vhost.conf":
    mode: "000777"
    owner: root
    group: root
    encoding: plain
    content: |
      NameVirtualHost *:80

      <VirtualHost *:80>
        ServerName api.domain.com
        DocumentRoot "/var/app/current/api/"
        <Directory "/var/app/current/api">
          AllowOverride All
          Require all Granted
        </Directory>
      </VirtualHost>

container_commands:
  00_chmod:
    command: "sudo chmod 777 /etc/httpd/conf.d/elasticbeanstalk"
  01_rewrite:
    command: "sudo mv -f /home/ec2-user/vhost.conf /etc/httpd/conf.d/elasticbeanstalk/vhost.conf"
  02_apache:
    command: "sudo apachectl restart"

这是我正在使用的配置,我得到它正在寻找解决我的问题的方法,现在对此有疑问,但 asnwers 已过时并且不起作用;配置运行正确我可以在日志中确认该命令运行没有错误,但是当我 ssh 进入 ec2 时,目录中没有 conf 文件,我假设 eb 在部署后将它们删除。

有人知道发生了什么吗? aws 文档几乎没用。

【问题讨论】:

  • "目录下没有conf文件" - 哪个文件?哪个目录?
  • 在 ec2 实例的 /etc/httpd/conf.d/elasticbeanstalk 中,我 ssh 进入并验证了 conf 不是他们的。命令:“sudo mv -f /home/ec2-user/vhost.conf /etc/httpd/conf.d/elasticbeanstalk/vhost.conf”

标签: amazon-web-services amazon-elastic-beanstalk


【解决方案1】:

对 http 的更改必须使用 .platform/httpd/conf.d,而不是常规的 .ebextentions。详细信息和示例在“配置 Apache HTTPD”下的AWS docs

要扩展 Elastic Beanstalk 默认 Apache 配置,请将 .conf 配置文件添加到应用程序源包中名为 .platform/httpd/conf.d 的文件夹中。

【讨论】:

  • 好的,理想情况下,我把它放错了地方,我实际上应该在我的包中创建一个目录 .platform->httpd->conf.d->myfile.config ?在链接的 aws 文档上找不到对“配置 Apache HTTPD”的引用。
  • @alexmalcolm 位于“反向代理配置”下。
  • 啊,好吧,不用担心,抱歉,aws 文档很大,所以我用命令 + f 标题。
  • 感谢您为我指明正确的方向,我投了这个答案,希望现在看到这个的任何人都不会被指向 ebextension 的过时答案误导。
猜你喜欢
  • 2016-04-05
  • 2018-10-13
  • 2015-05-14
  • 1970-01-01
  • 1970-01-01
  • 2018-08-31
  • 2011-07-10
  • 2018-04-18
  • 2015-07-28
相关资源
最近更新 更多