我想为我的网站安装一个负载均衡器并使网站保持最新。当处理能力达到一定水平时,负载均衡器将采用我选择的 AMI 并启动更多这些实例。问题是 AMI 可能不是最新的,所以我会有一些实例是最新的,而另一些则不是。当我部署时,我可以毫无问题地部署到负载均衡器下的所有实例,但我需要知道负载均衡器何时启动新实例以触发此部署。当更新发生时,也会有一段时间大大降低其响应能力。所以我想出了一个计划。
我的计划:
部署后:
identify one of the instances and
get instance id
identify volume of instance id
ec2-create-snapshot vol-yyyyyyyy
get snapshot volume id
ec2reg -s snap-zzzzzzzz -a x86 -d Description -n imagename
get image id
as-delete-launch-config existinglaunchconfig
as-create-launch-config mylaunchconfig --image-id IMAGEID --instance-type m1.small --key mykey --group mysecuritygroup
as-update-auto-scaling-group --launch-configuration mylaunchconfig
Run Code Online (Sandbox Code Playgroud)
在我花很多时间试图弄清楚这一点并编写所有脚本、测试和其他所有内容之前,我的问题是:这行得通吗?有没有更好的办法?是否有任何人都知道的教程或帖子可以加快我在这个问题上的努力?谢谢。
load-balancing amazon-web-services amazon-elb amazon-cloudwatch
我有一个常规实例,当不在负载平衡器后面时它可以正常工作。我设置了一个 ELB,80 转发到 80,443 转发到 443 和粘性会话。之后,我在访问任何 https 页面时收到此错误。
The plain HTTP request was sent to HTTPS port
Run Code Online (Sandbox Code Playgroud)
我处理在我的 nginx 配置中的某些页面上强制使用 https 的过程。我需要做什么才能让它发挥作用?我在下面放置了我的 nginx 配置的准系统版本。
http {
include mime.types;
default_type application/octet-stream;
# Directories
client_body_temp_path tmp/client_body/ 2 2;
fastcgi_temp_path tmp/fastcgi/;
proxy_temp_path tmp/proxy/;
uwsgi_temp_path tmp/uwsgi/;
server {
listen 443;
ssl on;
ssl_certificate ssl.crt;
ssl_certificate_key ssl.key;
server_name www.shirtsby.me;
if ($host ~* ^www\.(.*)) {
set $host_without_www $1;
rewrite ^/(.*) $scheme://$host_without_www/$1 permanent;
}
location ~ ^/(images|img|thumbs|js|css)/ {
root /app/public;
}
if ($uri ~ ^/(images|img|thumbs|js|css)/) { …Run Code Online (Sandbox Code Playgroud)