Elastic Beanstalk上的反向代理将子目录转发到子域

时间:2020-07-11 20:28:35

标签: amazon-web-services nginx amazon-elastic-beanstalk nginx-reverse-proxy

我们将Elastic Beanstalk用于我们的前端:https://tutorspot.co.uk。我们在https://blog.tutorspot.co.uk也有一个Wordpress博客,但我希望在https://tutorspot.co.uk/blog有该博客。我正在尝试在EB上的Nginx中配置反向代理,但运气不好,无法通过配置部署应用。

我不想覆盖整个Nginx配置,只需对其进行扩展以包括/blog路径的新位置块。

这是我要开始使用的配置:

location /blog/ {
   proxy_pass https://blog.tutorspot.co.uk;
   proxy_set_header Host $host;
   proxy_set_header X-Real-IP $remote_addr;
   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   proxy_set_header X-Forwarded-Proto $scheme;
}

Elastic Beanstalk docs建议将其放入*.conf中的.platform/nginx/conf.d/文件中,但是在部署新配置时遇到了以下问题:

Unsuccessful command execution on instance id(s) 'i-xxxxxxxxxxx'. Aborting the operation.

我不确定这是否是正确的配置,是否在错误的位置,或者配置本身是否不正确。例如,是否需要将location块包装在serverhttp上下文中?

任何帮助将不胜感激!

NB 1: 在生产中,我们正在使用Amazon AMI,但是,我借此机会将我们升级到Amazon Linux 2。

注意2: 以下是文件夹结构,显示了配置文件相对于.ebextensions等的位置:

enter image description here

0 个答案:

没有答案