Publishing your websites to Cloud Hosting

Ekrem Hatipoglu
Huawei Developers
Published in
4 min readMay 28, 2020
Huawei Mobile Services — Cloud Hosting

Introduction

HMS Cloud Hosting provides secure, fast, free, serverless hosting service. You can publish your dynamic or statics web pages on Cloud Hosting.

Whether it’s a web app, a static or dynamic landing page for your mobile apps or a simple personal home page you can deploy your web project to Cloud Hosting using the Cloud Hosting service on App Gallery Connect.

When you deploy your project using this service, a subdomain is generated for you within *.hosting-dre.agconnect.link which your users can then access to view your web page.

Development

I will assume that you already have a project set up on AppGallery. If you do not, you can create one using the App Gallery Connect.

Step 1: Enable Cloud Hosting service on AppGallery Connect

You should enable Cloud Hosting on AppGallery Conect before start development. Enable to the below services

Your Project -> Project Settings -> Manage API -> Cloud Hosting

Your Project -> Build -> Cloud Hosting -> Enable now

Enable Cloud Hosting service on AppGallery Connect

Step 2: Create a new site

After the enable service you should create a new site. Click “New Site” button on Site management screen and set up to your hostname. When you set up your site name, click to OK button. Your site will be automatically created in seconds.

  • Site: It’s your site url. Users will access your web page using these url. Site name must be uniq. “.hosting-dre.agconnect.link” is automatically added to the end of the site name you entered.
  • Description (Optional): It’s your site description. It’s not mandatory.

Note: The domain name added to the end depends on the data storage location.

  • China: *.hosting-drcn.agconnect.link
  • Singapore: *.hosting-dra.agconnect.link
  • Germany: *.hosting-dre.agconnect.link
  • Russia: *.hosting-drru.agconnect.link

In this example my project data storage location is Germany and my site url is ekrmh.hosting-dre.agconnect.link

Note 2: You can create maxiumum 64 sites in a project.

Create a new site on site management page

You now have a site. When you click URL, you should see a error message on blank page. This is because we haven’t uploaded our web page yet.

A site that has not yet uploaded any files

Step 3: Develop your web page

Your web page must have “index.html” file in root path. “index.html” will be a inital route to your site. Otherwise Cloud hosting will not be able to find the inital page and will continue to show the same error.

Create an html file named index. (index.html)

We will create a simple web page by writing the codes below into your html file.

index.html

Step 4: Publish your web page

Your website is almost ready. Now all you have to do is upload your project to AppGallery Connect.

You can only update ZIP package to App Gallery Console. You must ZIP your project before upload. (Make you sure your file is .zip not .rar)

You should zip all the files in the folder, not the project folder. Your directory structure should be like that.

For create new site version click Your Site -> Manage Version -> New Version after the zip process. Click Browse and select your ZIP package then click Upload button. Your file will be upload. You can also enter the description for your site version but it’s optional not mandatory.

Upload your web page to AppGallery Connect

Note:

  • The package to be uploaded must be a ZIP package containing up to 2000 files. The maximum package size is 50 MB. After decompression, the package size cannot exceed 100 MB.
  • The package name cannot contain Chinese characters or spaces.

Step 5: Run

You have completed all the steps. If the version status changes to Released, the version is successfully released. You can go to your site link and display the your web page.

Go to your web page

Conclusion

In this article, you learned what is Cloud Hosting service and how to deploy your websites to Cloud Hosting.

You can find more information about Cloud Hosting at below the link.

Guide

That is all.

Thanks.

--

--