繁体   English   中英

AWS Elastic Beanstalk Multicontainer Docker配置上的HTTPS / SSL问题

[英]HTTPS/SSL Issues on AWS Elastic Beanstalk Multicontainer Docker Configuration

我有这个Multidocker配置,我的HTTP流量工作正常没有任何问题,但是,每当我尝试使用https时我得到408

{
    "AWSEBDockerrunVersion": 2,
    "containerDefinitions": [
        {
            "name": "users-managment",
            "image": "....",
            "essential": true,
            "memory": 256,
            "portMappings": [
                {
                    "hostPort": 3000,
                    "containerPort": 3000
                }
            ],
            "environment": [
                {
                    "name": "PORT",
                    "value": "3000" 
                }
            ],
            "mountPoints": []
        },
        {
            "name": "presence",
            "image": "...ecr",
            "essential": true,
            "memory": 256,
            "portMappings": [
                {
                    "hostPort": 3001,
                    "containerPort": 3001
                }
            ],
            "environment": [
                {
                    "name": "USERS_SERVICE",
                    "value": "http://users-managment:3000"
                },
                {
                    "name": "PORT",
                    "value": "3001" 
                }
            ],
            "links": ["users-managment"],
            "mountPoints": []
        },
        {
            "name": "signaling",
            "image": "...dkr.ecr...",
            "environment": [
                {
                    "name": "PORT",
                    "value": "3002" 
                }
            ],
            "essential": true,
            "memory": 256,
            "portMappings": [
                {
                    "hostPort": 3002,
                    "containerPort": 3002
                }
            ],
            "links": ["users-managment"],
            "mountPoints": []
        },
        {
            "name": "api-gateway",
            "image": "...dkr.ecr...",
            "essential": true,
            "memory": 128,
            "portMappings": [
                {
                    "hostPort": 80,
                    "containerPort": 80
                },
                {
                    "hostPort": 443,
                    "containerPort": 443
                }
            ],
            "links": ["signaling", "presence", "users-managment"],
            "mountPoints": []
        }
    ]
}

我有3个node.js服务器和一个Nginx服务器,所有图像都上传到Amazon Elastic容器存储库,我添加了一个带有amazon证书管理器的SSL证书,并且已经在弹性beanstalk负载均衡器配置中的经典负载均衡器中打开了一个端口443,检查连接到EB应用程序的安全组,并将所有HTTP和HTTPS流量重定向到负载均衡器。

这是nginx配置

#The actual HTTPS server
server {
    listen 80;
    listen 443;

    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;

    location /users {
        proxy_pass http://users-managment:3000;
    }

    location /docs/users {
       proxy_pass http://users-managment:3000; 
    }

    location /ice/servers {
        proxy_pass http://signaling:3002;
    }

    #For Server-1
    location /signaling/ {
        #Configure proxy to pass data to upstream node1
        proxy_pass http://signaling:3002/socket.io/;
        #HTTP version 1.1 is needed for sockets
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

    #For Server-2
    location /presence/ {
        #Configure proxy to pass data to upstream node2
        proxy_pass http://presence:3001/socket.io/;
        #HTTP version 1.1 is needed for sockets
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

}

解决方法:将实例端口设置为80,将实例协议设置为HTTP,同时保持负载平衡器端口443和协议HTTPS

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM