Elastic Beanstalk - Ebextension 配置文件未显示在 ec2 实例上

Elastic Beanstalk - Ebextension config file not showing on ec2 instance

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 文档几乎没用。

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

To extend the Elastic Beanstalk default Apache configuration, add .conf configuration files to a folder named .platform/httpd/conf.d in your application source bundle.