【发布时间】:2020-12-01 05:07:20
【问题描述】:
我在配置弹性 beanstalk 以在 Linux 环境中运行 2 个 asp.net 核心 API 时遇到一些问题。我要做的是部署一个名为 audit 的服务,该服务在端口 5005 上运行,而一个名为 idp 的服务在端口 5000 上运行。
发生的情况是我可以访问 idp API,但不能访问审计 API。
这是我的 zip 上传的样子:
审计/**
idp/**
.platform/ngnix/conf.d/elasticbeanstalk/01_custom.conf
档案
01_cusom.conf 包含:
location /audit{
proxy_pass http://127.0.0.1:5005 ;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /idp{
proxy_pass http://127.0.0.1:5000 ;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
Procfile 包含:
audit: dotnet audit/audit.dll
idp: dotnet idp/idp.dll
audit 和 idp 包含我的每个应用程序的 dll。
根据文档,应该发生的情况是 .platform/ngnix/conf.d/elasticbeanstalk/01_custom.conf 中设置的配置应该在机器上的 nginx 中设置。这实际上并没有发生。我已经连接机器,发现机器上只存在一个默认配置的文件。
为了确保这是我从 /etc/nginx/conf.d/elasticbeanstalk/00_application_conf 中部署的 zip (.platform/ngnix/conf.d/elasticbeanstalk/01_custom.conf) 添加的问题,然后重新启动了 nginx服务器。这实际上解决了我的问题。
所以问题似乎是部署机制没有按文档说明工作。 (https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/dotnet-linux-platform-nginx.html)
有人对此有解决方案吗?
编辑
我尝试将 01_custom.conf 放在以下位置,但似乎不起作用:
- .platform/ngnix/conf.d/elasticbeanstalk/
- .platform/ngnix/conf.d/
- .platform/ngnix 与文件 01_custom.conf
- .platform/ngnix 与文件 nginx.conf 文件,希望覆盖 /etc/nginx/nginx.conf 中的文件
【问题讨论】:
-
您确定您使用的是基于 Amazon Linux 2 的 EB,而不是 Amazon Linux 1。另外,如果您暴露了第二个端口,您是否为此调整了安全组?
标签: amazon-web-services asp.net-core amazon-elastic-beanstalk