我正在使用AWS ECS中的Docker。我有一台带有AWS ECS Docker代理的EC2机器,并且ECS任务包含3个容器:
- nginx容器
- application-nodejs容器
- staticfiles-nodejs-application容器。
我想支持非常大的流量。我需要设置AWS负载均衡器吗?还是我的nginx upstream设置就足够了?
nginx配置示例:
upstream appwww {
server app-www:3000;
}
server {
server_name my.home.net;
location / {
proxy_pass http://appwww;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
listen 443 ssl http2; # managed by Certbot
ssl_certificate......; # managed by Certbot
ssl_certificate_key........ # managed by Certbot
include /.......# managed by Certbot
ssl_dhparam /.....pem; # managed by Certbot
}
server {
if ($host = my.host.net) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name my.host.net;
return 404; # managed by Certbot
}
编辑
我已经画出了当前的架构图,并想要添加负载均衡器,应该把它放在哪里?自动扩展适用于这个架构图吗?应该使用一个还是多个EC2实例?多容器?多上游?