By default, 000webhost provides a secure connection for all 000webhostapp.com subdomains; however, this isn’t the case for custom domains. But, with this method, you can setup your custom domain with a secure HTTPS connection for free.
First, sign up for an account at 000webhost.com if you don’t already have one. Pick a unique site name and password to ensure security for your account.
Now, create a Cloudflare account at https://dash.cloudflare.com/sign-up. At the next screen, enter your domain name in the text box and click “Add Site”.
Make sure that the free plan is selected by clicking the first box on the left. Then when you’re ready, click “Confirm Plan”.
On this next screen, you’ll be asked to confirm your existing DNS records. Unless you know you should be keeping some of the records, you should delete them all now. If a dialogue box about missing records appears, click “Confirm”.
Next, you’ll be asked to change your nameservers. This is done at your domain registrar, and it varies by registrar. If you need help changing your nameservers, ask your registrar for help. When you’re done changing your nameservers, go back to Cloudflare and click “Done, check nameservers”.
Now, Cloudflare show you some basic settings to be configured. Configure them as follows, then click “Done”.
Note: This setup, while it enables some of the benefits of SSL (including fixing the insecure warning in some browsers), is partially insecure. However, it is the only option for setting up a domain on 000webhost. To read more, check out this article on the official Cloudflare Community forum. In order to enable full security via SSL, we suggest upgrading to Hostinger services, which allow for easy origin-based SSL installation.
Now, go to the “DNS” tab of your Cloudflare dashboard. Add the two cname records for your 000webhost free site, as seen in the “My Domains” section of your Control Panel. The cname records that you need to add are below.
"@" points to "yoursite.000webhostapp.com"
"www" points to "yoursite.000webhostapp.com"
“yoursite” needs to be replaced with your website name. And don’t use quotes. The “@” and “www” go in the “name” section when adding the records, and the 000webhostapp URL goes in the “Content” section.
Make sure that the orange cloud is turned off, or otherwise 000webhost will not accept your domain name. When all of that is done, your DNS page should look similar to what’s below:
Then, add your domain in your Control Panel, allowing a few minutes for DNS to propagate.
Once it has been added to your 000webhost panel, go back to Cloudflare and turn the orange cloud on. This will enable the SSL.
Then, simply design your website and add HTTPS in front of your domain when accessing your site. Simple as that!
If you want to skip all these steps and use HTTPS on your website, upgrade to Hostinger! All plans come with free automatic Let’s Encrypt SSL certificates, and also allow the use of third-party SSL certificates!
This tutorial was last updated on January 12, 2021.