思路
首选在ALB上面创建实例,然后设定两个监听并分别连接对应后端ECS服务器,一个443,一个80,然后取得ALB域名后,将CLOUDFLARE的CNAME指向ALB,然后再将阿里云的域名解析做同样的设置
Cloudflare:
DNS Setting add CNAME to ALB:
CNAME Name:ideait.xyz, Content:alb-3dxtce7yg8q9tysn94.cn-hongkong.alb.aliyuncs.com
CNAME Name:www, Content: Content:alb-3dxtce7yg8q9tysn94.cn-hongkong.alb.aliyuncs.com
![](http://mystudy.stevewen.com/wp-content/uploads/2021/11/16365542651-1024x578.png)
![](http://mystudy.stevewen.com/wp-content/uploads/2021/11/16365542881.png)
CNAME: WWW alb-3dxtce7yg8q9tysn94.cn-hongkong.alb.aliyuncs.com
CANME: @ alb-3dxtce7yg8q9tysn94.cn-hongkong.alb.aliyuncs.com
但有出现有些php或者JS file ip为ECS ip,但大部份是Cloudflare
![](http://mystudy.stevewen.com/wp-content/uploads/2021/11/16365544831.png)
![](http://mystudy.stevewen.com/wp-content/uploads/2021/11/16365545361.png)
2021-11-12 Updated
昨天出现没有www的时候域名访问出错,最后发现A record要这样设置,经测试除了电脑主机以外,其他的notebook上都没有再出现这个问题,下一步要测试ALB:
![](http://mystudy.stevewen.com/wp-content/uploads/2021/11/16367293091.png)
![](http://mystudy.stevewen.com/wp-content/uploads/2021/11/16367296511-1024x629.png)
![](http://mystudy.stevewen.com/wp-content/uploads/2021/11/16367297001-1024x490.png)
![](http://mystudy.stevewen.com/wp-content/uploads/2021/11/16367297381-1024x382.png)
![](http://mystudy.stevewen.com/wp-content/uploads/2021/11/16367297551-1024x588.png)
![](http://mystudy.stevewen.com/wp-content/uploads/2021/11/16367297701-1024x300.png)