certificateId
of axE1bo3)
.serverless.yml
, add CDN custom domain name configuration:# serverless.ymlcomponent: websitename: myWebsiteapp: websiteAppstage: devinputs:src:src: ./publicindex: index.htmlerror: index.htmlregion: ap-guangzhoubucketName: my-hexo-bucketprotocol: https# New CDN custom domain name configurationhosts:- host: www.example.com # Custom domain name to be configuredhttps:switch: onhttp2: offcertInfo:certId: 'abc'# certificate: 'xxx'# privateKey: 'xxx'
sls
command, and you can add the --debug
parameter to view the information during the deployment process:sls
is short for the serverless
command.$ sls --debugDEBUG ─ Resolving the template's static variables.DEBUG ─ Collecting components from the template.DEBUG ─ Downloading any NPM components found in the template.DEBUG ─ Analyzing the template's components dependencies.DEBUG ─ Creating the template's components graph.DEBUG ─ Syncing template state.DEBUG ─ Executing the template's components graph.DEBUG ─ Preparing website Tencent COS bucket my-hexo-bucket-1250000000.DEBUG ─ Bucket "my-hexo-bucket-1250000000" in the "ap-guangzhou" region already exist.DEBUG ─ Setting ACL for "my-hexo-bucket-1250000000" bucket in the "ap-guangzhou" region.DEBUG ─ Ensuring no CORS are set for "my-hexo-bucket-1250000000" bucket in the "ap-guangzhou" region.DEBUG ─ Ensuring no Tags are set for "my-hexo-bucket-1250000000" bucket in the "ap-guangzhou" region.DEBUG ─ Configuring bucket my-hexo-bucket-1250000000 for website hosting.DEBUG ─ Uploading website files from /Users/tina/Documents/hexoblog/hexo/public to bucket my-hexo-bucket-1250000000.DEBUG ─ Starting upload to bucket my-hexo-bucket-1250000000 in region ap-guangzhouDEBUG ─ Uploading directory /Users/tina/Documents/hexoblog/hexo/public to bucket my-hexo-bucket-1250000000DEBUG ─ The CDN domain www.example.com has existed.DEBUG ─ Updating...DEBUG ─ Waiting for CDN deploy success..DEBUG ─ CDN deploy success to host: www.example.comDEBUG ─ Setup https for www.example.com...DEBUG ─ Website deployed successfully to URL: https://my-hexo-bucket-1250000000.cos-website.ap-guangzhou.myqcloud.com.myWebsite:url: https://my-hexo-bucket-1250000000.cos-website.ap-guangzhou.myqcloud.comenv:host:- https://www.example.com (CNAME: www.example.com.cdn.dnsv1.com)17s › myWebsite › done
.cdn.dnsv1.com
in the output on the command line. Set the corresponding CNAME at your DNS service provider as instructed in CNAME Configuration. After it takes effect, you can access the custom HTTPS domain name.serverless.yml
, add API Gateway custom domain name configuration. This document uses the egg.js framework as an example, and the configuration is as follows:# serverless.ymlrestApi:component: "@serverless/tencent-apigateway"inputs:region: ap-shanghaiprotocols:- http- httpsserviceName: serverlessenvironment: releaseendpoints:- path: /usersmethod: POSTfunction:functionName: myFunction # The function name to which the gateway connects# Add API Gateway custom domain name configurationcustomDomains:- domain: www.example.comcertificateId: axE1bo3protocols:- https
sls
command, and you can add the --debug
parameter to view the information during the deployment process:sls
is short for the serverless
command.$ sls --debugDEBUG ─ Resolving the template's static variables.DEBUG ─ Collecting components from the template.DEBUG ─ Downloading any NPM components found in the template.DEBUG ─ Analyzing the template's components dependencies.DEBUG ─ Creating the template's components graph.DEBUG ─ Syncing template state.DEBUG ─ Executing the template's components graph.DEBUG ─ Starting API-Gateway deployment with name restApi in the ap-shanghai regionDEBUG ─ Using last time deploy service id service-lqhc88srDEBUG ─ Updating service with serviceId service-lqhc88sr.DEBUG ─ Endpoint POST /users already exists with id api-e902tx1q.DEBUG ─ Updating api with api id api-e902tx1q.DEBUG ─ Service with id api-e902tx1q updated.DEBUG ─ Deploying service with id service-lqhc88sr.DEBUG ─ Deployment successful for the api named restApi in the ap-shanghai region.DEBUG ─ Start unbind all exist domain for service service-lqhc88srDEBUG ─ Start bind custom domain for service service-lqhc88srDEBUG ─ Custom domain for service service-lqhc88sr created successfullly.DEBUG ─ Please add CNAME record service-lqhc88sr-1250000000.sh.apigw.tencentcs.com for www.example.com.restApi:protocols:- http- httpssubDomain: service-lqhc88sr-1250000000.sh.apigw.tencentcs.comenvironment: releaseregion: ap-shanghaiserviceId: service-lqhc88srapis:-path: /usersmethod: POSTapiId: api-e902tx1qcustomDomains:- www.example.com (CNAME: service-lqhc88sr-1250000000.sh.apigw.tencentcs.com)8s › restApi › done
.apigw.tencentcs.com
in the output on the command line. Once the corresponding CNAME is set and takes effects at your DNS service provider, you can access the custom HTTPS domain name.
Was this page helpful?