AWS ALB实现80端口跳转443端口
通过配置ALB策略实现
创建侦听器
首先需要创建 80、443 两个侦听器
创建侦听器规则
编辑 80 侦听器的规则
开放安全组
在ALB安全组上打开80、443端口
拓展
此功能类似与nginx的rewrite
server {
listen 80;
server_name example.com;
rewrite ^(.*)$ https://$server_name$1 permanent;
}
server {
listen 443 ssl;
server_name example.com;
# ssl on;
ssl_certificate /etc/nginx/ssl/2537729_example.com.pem;
ssl_certificate_key /etc/nginx/ssl/2537729_example.com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
location / {
root /data/web/;
index index.jsp index.html index.htm;
}