Hosting a static website with Skygear


You can host a static website on Skygear, which is useful for simple web apps and static landing pages.

Hosting a static webpage on Skygear cloud can be done with easily with skycli.

Say we have this simple webpage built with HTML, CSS and JavaScript.


If you want a simple project to work with while you are following the tutorial, download one here:

First, install skycli with npm.

npm install -g skycli

Then in your project directory, log into your Skygear account (the one you use to sign in

skycli login

Connect your project with your Skygear app. You should have set up an app at first.

skycli init

It will then walk you through the set up. Answer yes when you are asked if you want a static hosting directory.

You're about to initialze a Skygear project in this directory: /User/Your/File/Path. Confirm?
> yes

Select an app to associate with the directory:
> <select-one-from-the-list>

Do you want to create your static hosting directory (public)?
> yes

Select the project template:
> Empty

After skycli is initialised, you should see a public_html folder and a skygear.json file in your project directory.

Now, copy all your webpage related files into public_html folder, Skygear Static web hosting will only deploy files inside the public_html folder. Your project directory should like like this:


Note: If you are deploying a compiled project, make sure you have placed the build inpublic_html folder.

Then, in your terminal, go to you project directory and run skycli deploy .

When you see “Build completed successfully”, you will be able to access your static webpage on https://{your-app-name}

Share with us your static webpage hosted on Skygear below :heart:

Skygear updates: Custom domain for static assets is now supported on 😎