title: Deploy the website generated by teedoc to the cloud service provider's web service keywords: teedoc, deployment, cloud service provider, cloud server, web service
Self-built servers require you to purchase your own servers, configure servers, etc. It is not that difficult, but it is a little more complicated. Another option is to use web services provided by cloud service providers.
All we have to do is to upload the generated html page file to the web service of the cloud service provider, and then we can access it through the domain name provided by the cloud service provider. We only need to pay the service provider (usually traffic + number of requests) cost).
For example, the common ones are Alibaba Cloud, Tencent Cloud, AWS, Google Cloud, etc. For example, Alibaba Cloud provides OSS storage services, Tencent Cloud provides COS storage services, and is optimized for static websites, such as those without .html Accessing the link will automatically jump to the page with .html.
Note that some providers do not optimize static pages, and there may be some features that cannot be set. For example, Qiniuyun cannot support links without the end of
html, such as/testcannot automatically go to/test.html, And by default, access to/is not automatically transferred to/index.html, and404.htmlcannot be read directly from the storage bucket, and needs to be manually uploaded to the configuration of Qiniuyun
Here is Tencent Cloud as an example:
teedoc, you will get a bucket name (bucket name), such as teedoc-1250000000, and select the server address, such as region in Guangzhou is ap-guangzhouindex.html, set the 404 page to 404.html, if you don't need CDN, you can turn on mandatory HTTPS, so that users will always visit HTTPS sitesteedoc-1250000000.cos-website.ap-guangzhou.myqcloud.com, this domain name is your website domain name, you can access your website through this domain nameteedoc.example.com points to teedoc- 1250000000.cos-website.ap-guangzhou.myqcloud.com, after setting, you can access your website through teedoc.example.comThe website file is generated by teedoc, in the out directory, be sure to use the teedoc build command to generate it, not the teedoc serve command to generate it!
Then upload to Tencent Cloud:
teedoc-upload --progress raw --cloud tencent --region ... --bucket ... --secret_id ... --secret_key ... out
Here ... fill in the corresponding information, secret_id and secret_key click on the console avatar -> select access management -> API key management -> create key, then you can see it, you can consider creating a special one Sub-account, and then only give this sub-account COS permissions, which can ensure a certain degree of security.
In addition, if the progress bar cannot be printed in the automatic build system, add the parameter --progress raw; and the secret key is best hidden, for example, the action of github provides the function of secret:
teedoc-upload --progress raw --cloud tencent --region ${{ secrets.TENCENT_REGION }} --bucket ${{ secrets.TENCENT_BUCKET }} --secret_id ${{ secrets.TENCENT_SECRET_ID }} --secret_key ${{ secrets.TENCENT_SECRET_KEY }} out
After uploading a file for the first time, you do not need to upload all the files every time in the future, you only need to upload the updated files, which can save time and traffic, such as:
teedoc-upload --progress raw --cloud tencent --region ... --bucket ... --secret_id ... --secret_key ... old_out out
Here old_out is the website file generated last time, out is the website file generated this time, teedoc-upload will automatically compare the two folders, and then upload only the updated file.