[TOC] #### 1. 登陸騰訊云官網(wǎng),進(jìn)入騰訊云對(duì)象存儲(chǔ)COS控制臺(tái) --- 騰訊云:[https://cloud.tencent.com](https://cloud.tencent.com) ![](https://img.itqaq.com/art/content/6c39ae245cca5cade5f105350a7f59cf.png) #### 2. 創(chuàng)建存儲(chǔ)空間 --- ![](https://img.itqaq.com/art/content/adf67cecee96457ce0c0943950fff5a6.png) ![](https://img.itqaq.com/art/content/f15296412983b82cc8b980c83ab2d2a6.png) #### 3. 添加自定義CDN加速域名 --- **在騰訊云COS的指定的存儲(chǔ)桶中添加自定義CDN加速域名** ![](https://img.itqaq.com/art/content/87718253dd6d93a2ce6e919ff437c74c.png) **在阿里云官網(wǎng)添加一個(gè)解析記錄,等待兩分鐘就可以用該域名訪問騰訊云COS中的文件了** ![](https://img.itqaq.com/art/content/34ce11980367527b0433f1daf9e79ca1.png) #### 4. 購買騰訊云免費(fèi)SSL證書 --- ![](https://img.itqaq.com/art/content/f573a5ccacddd8049492a6de13686b43.png) ![](https://img.itqaq.com/art/content/a7919e1b5790accc5c98a71e83b133a9.png) ![](https://img.itqaq.com/art/content/162ea6c52e29bf4406cf068fd786dac3.png) ![](https://img.itqaq.com/art/content/faca49d8bf093bb1b52f9d44340a7f18.png) ![](https://img.itqaq.com/art/content/4c820f3837434ce6124785bed0e48394.png) **此時(shí)去域名服務(wù)商添加一個(gè)解析記錄** ![](https://img.itqaq.com/art/content/20926c8fdda37099a8b83f43e84e0da3.png) **我的域名在阿里云上,所以我去阿里云解析了一個(gè)記錄** **解析記錄添加完成后點(diǎn)擊上圖中的 `查看域名驗(yàn)證狀態(tài)`** ![](https://img.itqaq.com/art/content/d9950f8fcde5d1f2e5d8f477a796abf4.png) #### 5. 騰訊云 CDN 域名部署 SSL證書 --- **解析記錄添加正確后,點(diǎn)擊 `查看域名驗(yàn)證狀態(tài)` 會(huì)跳轉(zhuǎn)到以下頁面,點(diǎn)擊一鍵部署** ![](https://img.itqaq.com/art/content/cf3fed4d44b089f9e18361cfb8b56db1.png) ![](https://img.itqaq.com/art/content/f39d60ec32609bd73f790cf46b85b74f.png) **然后會(huì)跳轉(zhuǎn)到以下頁面** ![](https://img.itqaq.com/art/content/879ebd70b46a5e971c1b81846f4e4e6f.png) **提示配置成功,等待兩分鐘左右就可以用HTTPS訪問存儲(chǔ)空間中的文件了** ![](https://img.itqaq.com/art/content/a9cbb9a47b8dd06f41f4fd5684145ab9.png) #### 6. 測(cè)試自定義域名HTTPS訪問COS中的文件 --- **進(jìn)入存儲(chǔ)桶,先上傳一個(gè)圖片,然后點(diǎn)擊詳情** ![](https://img.itqaq.com/art/content/26b65ad33410a7c521b32791235a0f84.png) **復(fù)制圖片訪問地址,可以正常訪問即配置成功** ![](https://img.itqaq.com/art/content/14c6938d54f3ac00a888eb7e0656dfd1.png) #### 7. 創(chuàng)建騰訊云子賬戶,授予對(duì)象存儲(chǔ)權(quán)限,獲取訪問密鑰 --- **進(jìn)入訪問管理控制臺(tái)** ![](https://img.itqaq.com/art/content/4db7c951f3dd5f82f3639611d0e79254.png) **新建一個(gè)用戶,用于對(duì)象存儲(chǔ)COS** ![](https://img.itqaq.com/art/content/4036be79948d43832cfe52a36bc60511.png) **選擇自定義創(chuàng)建** ![](https://img.itqaq.com/art/content/3e992c1449d50956388db52e3049dfba.png) ![](https://img.itqaq.com/art/content/4ac29b3ea1673da65a001511c39bb750.png) **填寫用戶信息,訪問方式設(shè)置為 `編程訪問`** ![](https://img.itqaq.com/art/content/95c0f0ee6a2397a0365ae98ec8b96683.png) **給子賬戶授予權(quán)限** ![](https://img.itqaq.com/art/content/b91db352d284717189cc329e0170925e.png) **第四步 `審閱信息和權(quán)限` 就是讓你看看你填寫信息,直接點(diǎn)擊完成即可** ![](https://img.itqaq.com/art/content/e612b2c6167f51a442639e3034708ea8.png) **用戶創(chuàng)建成功會(huì)給你一對(duì)訪問密鑰** ![](https://img.itqaq.com/art/content/0ea12c979c485fd9e63b2565d9db8d0f.png) ``` 主賬號(hào)ID 100010617990 用戶名 zhangsan 登錄密碼 - SecretId AKID63KOBo4QhfKkvqq5k8KNDo9broQqH0Rc SecretKey HNGzRdsteI3LJ9oHGY4SeLwGySDhv8KN ``` #### 8. 到此為止,項(xiàng)目中對(duì)接騰訊云對(duì)象存儲(chǔ)所需參數(shù)都有了 --- ``` APPID(存儲(chǔ)桶ID):1259508442 SecretId:AKID63KOBo4QhfKkvqq5k8KNDo9broQqH0Rc SecretKey:HNGzRdsteI3LJ9oHGY4SeLwGySDhv8KN Bucket(存儲(chǔ)桶名稱):chenduxiu Bucket所在區(qū)域:北京 訪問域名(自定義CDN加速域名):https://cos2.itqaq.com ``` #### 9. 在微擎中使用騰訊云對(duì)象存儲(chǔ) COS(各參數(shù)說明) --- **微擎中使用騰訊云存儲(chǔ)示例** ![](https://img.itqaq.com/art/content/5603811e68aa914441e06a4ba4b2fc51.png) **APPID:騰訊云存儲(chǔ)桶的ID** ![](https://img.itqaq.com/art/content/63669a9e576a525c972074f839a5e555.png) **SecretID、SecretKEY** 訪問密鑰,不建議直接使用總賬號(hào)生成密鑰。推薦創(chuàng)建一個(gè)子賬戶,授予對(duì)象存儲(chǔ)的權(quán)限即可,使用子賬戶的訪問密鑰 **Bucket、bucket所在區(qū)域 對(duì)應(yīng)創(chuàng)建存儲(chǔ)桶時(shí)填寫的內(nèi)容** ![](https://img.itqaq.com/art/content/17801cf5530d88b90f371254099f320e.png) **Url** 此處填寫自定義的CDN加速域名,當(dāng)然也可以使用騰訊云提供的默認(rèn)的訪問域名