AWS Elastic beantalk似乎没有复制我的ngnix自定义配置

问题描述

在配置弹性beantalk以在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。

根据文档,应该发生的是,应该在计算机的nginx中设置.platform / ngnix / conf.d / elasticbeanstalk / 01_custom.conf中设置的配置。这实际上并没有发生。我已连接到计算机,发现计算机上仅存在具有默认配置的文件。

为确保这是我从/etc/nginx/conf.d/elasticbeanstalk/00_application_conf中的已部署zip(.platform / ngnix / conf.d / elasticbeanstalk / 01_custom.conf)添加的问题,然后重新启动ngnix服务器。这实际上解决了我的问题。

因此,问题似乎在于部署机制无法按文档所述工作。 (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中的一个

解决方法

您应该在其中放置自定义nginx脚本的文件夹位于.platform / nginx / conf.d /

不要放在elasticbeanstalk / 01_custom.conf

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/platforms-linux-extend.html

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...