Overview
TEM provides static website resource hosting capabilities through application instance + CFS. This document takes the popular static website service Hugo as an example to describe the practical tutorial for static resource hosting. The following will generate a personal static blog through Hugo, deploy a reverse proxy application through TEM, work together with CFS to manage static resources, and finally offer access to the personal static blog over the public network through the access configuration in TEM. The overall process is as follows:
Directions
Step 1. Generate a static blog locally through Hugo
1. Install Hugo (for more information, please see Install Hugo). Taking macOS as an example, install it with the following command:
2. Run the following command to create a static site.
3. Run the following command to add a theme.
cd quickstart
git init
git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
echo theme = \\"ananke\\" >> config.toml
4. Run the following command to add a blog.
hugo new posts/my-first-post.md
5. Run the following command to build a static page.
6. The generated static content is stored in the public/
directory of the quickstart
project.
Step 2. Upload the static blog content to CFS
Note:
The region and VPC of the purchased CFS file system should be the same as those of the application deployed in TEM.
Step 3. Deploy the nginx application in TEM and associate CFS
1. Log in to the TEM console and associate the CFS instance purchased above with the environment where the application is deployed. 3. Deploy the application and select the associated CFS storage resource in the Persistent Storage module.
Scheme 1. Configure a forwarding rule (recommended)
Scheme 2. Configure public network CLB
1. On the Application Management page, click the ID of the application you just created to enter its basic information page. 2. On the application basic information page, click Configure Now in the Access Configuration module to enter the environment access configuration page.
3. On the environment access configuration page, click Create to create an access configuration rule.
4. Click Complete to get the following IP address.
Access the Hugo service at the generated address:
1. On the Application Management page, click the ID of the application you just created to enter its basic information page. 2. On the application basic information page, click Edit and Update in the top-right corner of the Access Configuration module to add a public network CLB instance.
3. Select the public network access method and enter the port mapping relationship.
4. Click Submit to get the following public IP.
Access the Hugo service at the generated address:
Step 5. (Optional) Configure a domain name
1. Register a domain name.
2. Associate the domain name with the CLB instance generated above, and you can access the static website at the domain name. For more information, please see Getting Started with CLB. In order to deliver a better user experience, the hosted static website can be connected to Tencent Cloud CDN for access acceleration. For more information, please see Getting Started.
Was this page helpful?