简体   繁体   English

如何使用Varnish和Nginx向AWS Load Balancer发出HTTPS请求?

[英]How to make HTTPS requests to AWS Load Balancer with Varnish and Nginx?

I have the following structure at AWS: 我在AWS上具有以下结构:

Route 53 DNS -> HTTPS Load Balancer(South America) -> Varnish(South America) -> Nginx(South America) -> Route 53 -> HTTPS Load Balancer(Oregon) -> Backend Ec2 instances(Oregon). Route 53 DNS-> HTTPS负载均衡器(南美)-> Varnish(南美)-> Nginx(南美)-> Route 53-> HTTPS负载均衡器(俄勒冈)->后端Ec2实例(俄勒冈州)。

I know, it can be improved, but now I need to solve this thing. 我知道,它可以改进,但是现在我需要解决这个问题。 I can't connect to the Load Balancer in Oregon. 我无法连接到俄勒冈州的负载均衡器。 I generated the certificates with AWS ACM. 我使用AWS ACM生成了证书。 That's my config in Nginx: 那是我在Nginx中的配置:

   include /etc/nginx/conf.d/*.conf;

    server {
        listen       8080 default_server;
        listen       [::]:8080 default_server;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
         proxy_pass https://mydns:443/;
         proxy_set_header X-Real-IP $remote_addr;
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
}

Should I need to configure SSL in Nginx? 我是否需要在Nginx中配置SSL? And if so, how can I get the certificate generated at AWS? 如果是这样,我如何获得在AWS生成的证书?

Thank you now! 现在谢谢你!

Maybe, your problem is this: 也许,您的问题是这样的:

You have a Load Balancer in South America, which it has a VPC with subnets and you want to connect to another Load Balancer located in Oregon which it has another VPC with other subnets. 您在南美有一个负载均衡器,它的VPC带有子网,并且您想连接到位于俄勒冈州的另一个负载均衡器,而该负载均衡器还有另一个带有其他子网的VPC。

Your nginx is located in South America and you want to connect to Oregon. 您的nginx位于南美,您想连接到俄勒冈州。 Unless you are going to Internet (Your nginx must have access to Internet), there are two possibilites: 除非您要访问Internet(您的nginx必须访问Internet),否则有两种可能性:

  • You're going to a public hosted zone but LB is not configured to receive traffic from your AWS's South America IPs. 您将转到公共托管区域,但LB未配置为从您的AWS的南美IP接收流量。
  • You're going to a private hosted zone and VPC peering is needed to make the connection. 您将转到私有托管区域,并且需要VPC对等才能建立连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 Elastic Load Balancer 和 EC2/Nginx 解决 HTTPS 请求的 502 Bad Gateway 错误? - How to solve 502 Bad Gateway errors with Elastic Load Balancer and EC2/Nginx for HTTPS requests? 在AWS Load Balancer之后使用Nginx将http重定向到https - Redirecting http to https using nginx behind AWS load balancer NGINX-HTTPS负载均衡器配置 - NGINX - HTTPS Load Balancer Configuration 如何将nginx与Kubernetes(GKE)和Google HTTPS负载均衡器配合使用 - How to use nginx with Kubernetes (GKE) and Google HTTPS load balancer 如何使用nginx从http负载均衡器迁移到https - How to migrate from a http load balancer to a https one with nginx 我如何在nginx负载均衡器上将https重定向到http - how do i redirect https to http on nginx load balancer 如何在 aws 经典负载均衡器上重定向 http -> https? - How to redirect http -> https on aws classic load balancer? Nginx负载均衡器支持HTTP和HTTPS - Nginx Load balancer support HTTP and HTTPS 前面的 AWS 应用程序负载均衡器,后面有 https 侦听器和 nginx 反向代理服务器 - AWS Application load balancer in front with https listener and nginx reverse proxy server behind it 如何配置HTTPS Nginx + Pagespeed + Varnish + Apache? - How to configure HTTPS Nginx + Pagespeed + Varnish + Apache?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM