You can access the website you needed by using HTTPS according to Simple routing - change HTTP to HTTPS. For example, use the following application template:
# Here only the http/https/ws/wss protocol
After configuring the Server Load Balancer, access the HTTPS website.
You can also configure to force the HTTP request to redirect to HTTPS.
The following example configures an Nginx container and adds the rewrite rules to the configuration file, namely, when request
http://www.example.com is received,
301 is returned and the request is automatically redirected to
Log on to each machine in the cluster. Create the Nginx configuration file
/ngx/nginx.conf, which will be mounted to the Nginx container as a volume. The
/ngx/nginx.conf is as follows:
error_log /var/log/nginx/error.log warn;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
access_log /var/log/nginx/access.log main;
return 301 https://$host$request_uri;
The Nginx container template is as follows:
- 80:80/tcp # Map to port 80 of the host.
aliyun.global: true # Deploy an Nginx container on each machine to guarantee the high availability.
The Server Load Balancer settings for the cluster is as follows (frontend port 80 > backend port 80, namely, Server Load Balancer frontend port 80 > backend Elastic Compute Service (ECS) instance port 80):
When you access
http://www.example.com, the returned HTTP is as follows. This means the request is correctly redirected to