In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article is shared from the official account of Wechat: Tencent Cloud Storage (follow and surprise)
Static websites: different from dynamic websites, they only contain static content (such as pictures, audio, video, HTML, CSS, JS) and do not rely on server-side dynamic rendering of pages. So how should static website hosting be used?
Today, I would like to share with you about the "stupid" static website hosting trip.
Users can host static websites on Tencent Cloud object Storage (hereinafter referred to as COS), and visitors can use custom domain names (such as www.example.com)
Visit a hosted static website. Here are the specific steps:
Prepare beforehand
The following are the relevant services that will be used in practice:
Domain name registration: before hosting a static website, you need to register a domain name, such as www.example.com.
Object storage COS: use COS to create a bucket, and the uploaded web content will be stored in the bucket.
Content distribution network CDN: combined with CDN and cloud resolution service, domain name and website content can be bound, at the same time, static websites can be accelerated, access latency can be reduced, and availability can be improved.
Cloud resolution: use cloud resolution to achieve the purpose of using custom domain names to access static websites.
Description:
All the steps in this guide use www.example.com as the sample domain name. In practice, please replace this domain name with your own domain name.
4 steps to complete static website hosting
01
Registration of domain name and filing
Domain name registration is the basis for establishing any service on the Internet. After registering the domain name, you still need to put it on record before the website can be accessed normally. Please do it according to your specific situation:
If the domain name has been registered and put on record, you can skip this step and proceed to step 2
The domain name has been registered but has not been filed. Please record the domain name.
If the domain name is not registered, please register the domain name first, and then record the domain name.
02
Create a bucket and upload the content
After completing domain name registration and filing, you need to perform the following tasks in the COS console to create and configure site content:
Create a bucket
Configure buckets and upload content
2-1. Create a bucket
Log in to the COS console using your Tencent Cloud account to create a bucket for your website. The bucket is used to store data, and you can store the website content in a bucket.
If you use COS for the first time, you can create buckets directly through the overview interface of the console, or in the bucket list navigation bar.
2-2. Configure buckets and upload content
Open the static website settings for the bucket by:
1) Log in to the COS console, in the left menu bar, click "Bucket list", locate the bucket you just created, and click "configuration Management" on the right.
2) find the static website, click Edit, set the current status to on, and leave other settings as default for the time being, and click Save.
3) upload the content of your website to the bucket you have created. The content stored in the bucket can be text files, photos, videos, whatever you want to host. If you haven't built your Web site yet, just follow this practice to create a file.
For example, you can use the following HTML to create a file and upload it to a bucket. The file name of the home page of a website is usually index.html. In the next steps, you will provide this file as an index document for the Web site. Set up
Hello COS!
Welcome to the static website feature of & nbspCOS .
This is the home page!
Note: when the static website feature is enabled, when a user accesses any first-level directory without a file pointing, COS will first match index.html in the corresponding bucket directory by default, followed by index.htm. If there is no such file, 404 will be returned.
03
Bind a custom domain name
To speed up access, we recommend that you bind your domain name to a custom accelerated domain name, and accelerate your static website with Tencent Cloud CDN, so that website visitors can get a better browsing experience.
3-1. Domain name addition
1) Log in to the COS console, in the left menu bar, click "Bucket list", click the bucket where the content of the website is stored and enter.
2) in the left secondary menu bar, click "Domain name Management" to go to the domain name management page, and click "add Domain name" under "Custom accelerated Domain name" to enter the configurable state:
Domain name: enter the custom domain name you have purchased
Origin server type: select static website origin server
Origin authentication: check it, and then click Save.
3) after clicking Save, follow the prompts to continue to add "CDN Service Authorization".
In the CDN service authorization pop-up window, click OK.
4) wait a few minutes and wait for the domain name deployment to be launched. Then copy the corresponding CNAME record and perform the following steps.
3Mutual 2. Domain name resolution
If you use a third-party service provider to register a domain name, add a CNAME to your custom domain name at the service provider and point to the corresponding CNAME record in step 3.1.
If you use Tencent Cloud resolution service, please refer to the following:
1) Log in to the Cloud Resolution console, find your domain name, and click * * Resolution * * on the right.
2) Click the add record button.
Host record: www
Record type: CNAME
Record value: the corresponding CNAME record in step 3.1
Then click Save to complete the addition.
04
Test verification
After completing the above steps, you can verify the practice results by entering the website domain name in the browser address bar. Take www.example.com as an example:
Http://www.example.com-returns the index page (index.html) in the bucket named example.
Http://www.example.com/test.html (file that does not exist)-returns a 404 prompt. If you need to customize the error document, you can further set the [error document] in the [static website] setting in step 2.2. At this time, accessing a file that does not exist will display the specified error document.
Note: in some cases, you may need to clear the browser cache to see the expected results.
Scan the scan and pay attention to the surprise.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.