阿里云对象存储OSS如何使用 HTTPS

一、前言阿里云对象存储oss本身也是可以用https直接访问的,但是它本身的地址是http://***.oss-cn-hangzhou.aliyuncs.com这样的,那么如果我们想使用自己的域名,并且https加密,实现,防钓鱼,防劫持,防篡改,如何实现呢?
二、域名解析2.1 oss本身域名:?http://abc.oss-cn-hangzhou.aliyuncs.com
2.2 自定义的域名: https://image.myname.com
首先我们将 image.myname.com 解析到一个有公网ip阿里云ecs服务器上,阿里云上提供域名解析的服务
三、nginx重定向vim oss.conf
server {
listen 80 ;
listern 443 ssl;
server_name image.myname.com;
access_log logs/oss_access.log;
error_log logs/oss_error.log;
ssl_certificate certs/_.***.crt;
ssl_certificate_key certs/_.***.key;
if ($scheme = http) {
return 301 https://$server_name$request_uri;
}
loccation ~ /abc/ {
rewrite ^(.*)/(.*)$ http://abc.oss-cn-hangzhou.aliyuncs.com/$2 last;
proxy_set_header host $host;
proxy_set_header x-real-ip $remote_addr;
proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
}
}