Prerequisites: Cloudflare - Cloudbox/Cloudbox GitHub Wiki
Intro
Cloudflare a service that, among other things, protects and accelerates a wide network of websites. By being the "man in the middle", it can act like a free DNS provider.
Cloudbox makes adding subdomains to Cloudflare's DNS settings a breeze via automation. All you need is the API key.
Note that there are some top-level domains [TLDs] that will not work with this automation. Refer to this page.
As of 2020/07/26: "DNS API cannot be used for domains with .cf, .ga, .gq, .ml, or .tk TLDs."
Although Cloudflare is not required for Cloudbox, it is still recommended because:
-
DNS changes propagate almost instantly (a lot faster than a domain provider's DNS service).
-
Hide your server's IP behind Cloudflare's.
-
Makes setting up Mediabox / Feederbox a lot quicker.
-
Allows for automated setup of subdomains for Cloudbox add-on apps.
-
Can optionally enable CDN / Proxy for your subdomains.
-
It's free.
Note: Cloudbox does not enable CDN / Proxy by default, but you may do so yourself after installing Cloudbox (see section below).
Sign Up
-
Sign up for a free Cloudflare account.
-
On your Domain Registrar's website (e.g. GoDaddy, Namecheap, etc), set the Name Servers to what Cloudflare instructs you to.
-
Examples:
-
Namecheap.com -> "Dashboard" -> your domain.ltd -> "Manage" -> "Name Servers" -> "Custom DNS" -> add the nameservers in.
-
Namesilo.com -> "Manage My Domains" -> your domain.ltd -> "NameServers" -> "Change" -> add the nameservers in.
-
-
Setup
-
Go to Cloudflare.com.
-
Here you will see that your domain will have an "Active" status. Click on your domain to continue.
-
Click the SSL/TLS tab.
-
Set SSL to
Full (strict)
.
Cloudflare API Key
-
Go to Cloudflare.com.
-
Click the Overview tab.
-
Click Get your API token.
-
Under API Keys and then Global API Key click View.
-
On the login popup, type in your password and click View.
-
Save your API key.
Post-Setup
After Cloudbox has added in the subdomains, you may go back in and turn on CDN for for them if you like.
But do this AFTER all your certs have been assigned and you have confirmed that all the Cloudbox app sites are loading OK.
This also applies to any app/subdomains you add in the future - wait till after you get certs before enabling CDN.
Note 1: Performance of your server may vary when CDN is enabled.
Note 2: Leave the subdomains cloudbox
, mediabox
, and feederbox
as DNS Only
, as they were created to reach your servers directly and not behind a CDN proxy (i.e. they need to resolve to the server's IP and not Cloudflare's).
You can do this by:
-
Going to Cloudflare.com.
-
Clicking the DNS tab.
-
Find the subdomain of interest.
-
Under "Status", click the gray cloud icon (i.e.
DNS Only
) to switch to an orange one (i.e.DNS and HTTP proxy (CDN)
).
If you do this to Plex/Emby subdomains, it is recommended that you disable caching or else you may be banned by Cloudflare for violating their TOS.
-
Going to Cloudflare.com.
-
Click the Page Rules tab.
-
Click the Create a Page Rule button.
-
Create a rule for the relevant subdomain.
-
If the URL matches:
subdomain.yourdomain.com/*
-
Then the settings are:
-
Cache Level:
Bypass
-
Disable Performance
-
-
-
Click the Save and Deploy button.