Beanstalk部署会忽略.ebextensions中的nginx配置文件 [英] Beanstalk deployment ignores my nginx configuration files in .ebextensions

查看:122
本文介绍了Beanstalk部署会忽略.ebextensions中的nginx配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Java Web应用程序托管在单实例Elastic Beanstalk环境中,并且添加了几个ebextension文件,这些文件在每次部署时都能为我成功创建配置文件.但是,我找不到让Beanstalk在/etc/nginx /etc/nginx/conf.d 目录中添加新配置的方法.

I host my Java webapp on a single-instance Elastic Beanstalk environment and I added several ebextension files which successfully create config files for me upon each deployment. I can't however find a way of getting Beanstalk to add new configs within the /etc/nginx or /etc/nginx/conf.d directories.

我按照此处描述的步骤操作: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/https-singleinstance-java.html

I followed the steps described here: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/https-singleinstance-java.html

我的部署程序包结构如下:

My deployment package structure looks like this:

$ zip -r deploy.zip api-1.0-SNAPSHOT-all.jar .ebextensions
  adding: api-1.0-SNAPSHOT-all.jar (deflated 11%)
  adding: .ebextensions/ (stored 0%)
  adding: .ebextensions/ssl-certificates.config (deflated 37%)
  adding: .ebextensions/https-instance-securitygroup.config (deflated 38%)
  adding: .ebextensions/nginx/ (stored 0%)
  adding: .ebextensions/nginx/conf.d/ (stored 0%)
  adding: .ebextensions/nginx/conf.d/https.conf (deflated 61%)

我的文件是上面指南中样本的近1对1副本.

My files are nearly 1-to-1 copy of samples in the guide above.

在部署期间,两个 *.config 文件均成功执行,但是缺少/etc/nginx/conf.d/https.conf .我试图通过删除 .ebextensions/nginx 目录并将其替换为另一个创建/etc/nginx/conf.d/的 .config 文件来解决该问题.从头开始https.conf ,但这没有帮助,文件仍然丢失.

During deployment both my *.config files execute successfully, but the /etc/nginx/conf.d/https.conf is missing. I tried to workaround the issue by removing the .ebextensions/nginx directory and replacing it with another .config file that creates /etc/nginx/conf.d/https.conf from scratch, but this didn't help and the file was still missing.

我将ssh-ed到我的EC2实例上,这就是在/var/log/eb-engine.log 中找到的内容:

I ssh-ed onto my EC2 instance and here's what I found in /var/log/eb-engine.log:

2020/05/03 19:42:37.754375 [INFO] Executing instruction: configure proxy Nginx
2020/05/03 19:42:37.754393 [WARN] skipping nginx folder under .ebextensions
2020/05/03 19:42:37.754670 [INFO] No plugin in cfn metadata.

我觉得我可能在这里错过了一些很明显的事情,但是令人惊讶的是我找不到解决问题的办法.有什么想法吗?谢谢!

I feel like I might have missed something very obvious here, but surprisingly I couldn't find any solution to my problem. Thoughts? Thanks!

推荐答案

我刚刚解决了同样的问题.

I have just solved the same problem.

您可以通过配置以下目录结构轻松解决此问题.

you can easily solve the problem by configuring the following directory structure.

~/my-app/
|-- readme.md
|-- .ebextensions/
|   |-- options.config       # Option settings
|   -- cloudwatch.config     # Other .ebextensions sections, for example 
-- .platform/
    -- nginx/                # Proxy configuration
        |-- nginx.conf
        -- conf.d/
            -- custom.conf
            -- elasticbeanstalk
               |-- server.conf

有关更多信息,请参见 url

for more information, see this url

我的/var/log/eb-engine.log显示了以下消息行.

my /var/log/eb-engine.log showed the message line below.

Running command /bin/sh -c cp -rp /var/app/staging/.platform/nginx/. /var/proxy/staging/nginx

这篇关于Beanstalk部署会忽略.ebextensions中的nginx配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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