Deploying a Hexo site on 000webhost is super easy!
Let’s remind some basics:
- Hexo is a static site generator. Meaning that you can generate a pure HTML site that does not rely on a backend server (PHP, nodejs, …)
- 000webhost is a very classic web hosting provider, it allow you to host a static web sites as well as a more traditional dynamic site with PHP. They try very hard to make you upgrade to their paid offer.
You’ll need your Hexo site built.
Then run the command
hexo g or
npx hexo g (if you don’t have hexo installed globally on your machine). If your configuration is standard, you should find your site in the folder
Once you are ready, go to https://www.000webhost.com/free-website-sign-up
I chose to login with my google account, but you can choose to create a local account
You’ll then be prompted to create a site with their site builder tool. You can skip that part :)
Just create a new website with a new random password
You’ll be able to use this password to upload your site via FTP (the alternative it to use their file manager, which isn’t usable to upload a site with multiple sub folders)
Via you ftp client (Filezilla for instance), login to
files.000webhost.com. The username is the website name you chose above, same for the password.
Once your site is uploaded, you can also tweak the
.htaccess file to handle your 404 page (if you have one). Here is the minimal content you could use:
ErrorDocument 404 /assets/404.html
If you want to automate ftp upload from github, you can probably use something like what I did with ftp upload to OVH:
or see my previous post on the subject: Travis setup
You can configure a domain to point to your site.
If your site url is tpi2-eu.000webhostapp.com like mine is, you can add a CNAME like this one:
CNAME: 000webhost.xn–tp-rja.eu -> tpi2-eu.000webhostapp.com
For me, the result is here:
You should not use them. There are much bette offer out there for free hosting.
- They add an ugly banner at the bottom of each pages (after thinking a bit about it, you should probably be able to kill it using CSP, and disallowing inline JS, but they might kick you out). I made a PR about that on free-for-dev
- They don’t provide SSL certificate if you use your own custom domain
- They got breached in 2015, with clear passwords: https://haveibeenpwned.com/PwnedWebsites#000webhost