How to configure Cloudflare for a site on Aruba with Shared Server
In this article, I will explain how to configure Cloudflare for a site on Aruba with Shared Server. Hence, we will take advantage of the global distribution network of Cloudflare, or CDN (Content Delivery Network), and their mitigation system of DDoS attacks.
In addition, in the following article, I will explain how to apply the rules defined with the Page Rules, in order to properly manage the cache of the pages.
More than just WordPress
The website can be built with WordPress, or for example, it can be a framework-based website or a custom architecture. What we need is to have access to the back office (often a Cpanel) of your hosting to be able to manage the DNS correctly.
Optionally, if your site is built in WordPress, you can install the official Cloudflare plugin. You can manage some settings, view analytics data, and even clear the cache, all directly from your WordPress backend.
You can still create a custom integration via the Cloudflare API if you have a custom site or one based on a framework.
What is Cloudflare?
From their website:
Cloudflare is one of the largest networks operating on the Internet. People use Cloudflare’s services to increase the security and performance of their websites and web services.Official website of Cloudflare.
A CDN is a global network that provides content, and other services, as close as possible to the requesting user, in order to get the information as fast as possible.
A practical example
Let’s assume that 3 people are browsing our site. The website is hosted on an Italian server. Your visitors are from 3 different countries such as the Netherlands, Portugal, and the USA.
A security layer with Cloudflare
Plus, even with the free plan, Cloudflare provides an extra layer of security by protecting websites and apps from DDoS attacks, malicious bots, and other intrusions.
These are good reasons to seriously consider using such a service. When properly configured, it is suitable for the blog that provides content, the e-commerce that sells products, or the app that provides services. Cloudflare also has a free plan, for personal or hobby projects, with a limit of 3 Page Rules per domain.
Create a Cloudflare account
To complete this, you need a Cloudflare account. You can create one from the registration page and in a few minutes, you are ready to set up your websites. We need a valid and working email. To recap:
- Visit https://dash.cloudflare.com/sign-up
- Enter a valid email address and password
- Click Create account
On the top right of the page, you can change the language of the page and display the page in your preferred language.
Here is the official Cloudflare documentation page that explains how to create a Cloudflare account and how to add a domain.
Add a domain
After creating a profile on Cloudflare and logging in, you will land on the main page of the Cloudflare control panel. Here you can add a new site (also called zone in Cloudflare). Simply click on the blue Add a site button. When you first log in, you won’t have any sites configured yet, so the button shows up in the middle of the page. Otherwise, it will be at the top right of the page body. The same button will be also in the main navigation bar at the top right of the page. See the image below:
Now add the domain you are interested in and click Add Site.
Then select a pricing plan. Cloudflare presents the 3 paid plans Pro, Business, and Enterprise first. If you are setting up Cloudflare for your personal blog, at the bottom is the Free plan box. Click on the box and then on the Continue button.
At this point, Cloudflare will analyze the DNS available for your site and present a list of them.
Note: the status of the proxy for the FTP record is DNS ONLY because otherwise, you will have problems accessing your site via FTP on Aruba shared servers. In the list, at the FTP row and the Proxy Status column, click on the icon to change the status.
At this point the Cloudflare side is almost complete, so let’s take note of the nameservers provided by Cloudflare.
I use a small clipboard history software, so I can copy two strings and carry the values with me between screens. The software in question is called ClipX.
In any case, it is sufficient to follow the guide provided on the page itself. In short, you need to access the hosting control panel and change the DNS.
Just look for a specific guide on how to change DNS if you have a different hosting than Aruba.
DNS management on Aruba shared server
Enter the control panel from the main page of Aruba, by clicking on the Customer area and Control panel. Unfortunately, another tab will open, but at this point, you are ready to log in to the panel. Once logged in, choose the domain whose DNS you want to transfer.
In Aruba’s section, the images localization will be in Italian because they are screenshotted from my Italian account. Anyway, there is the possibility to translate the pages in English.
In the side navigation, the one on the left, click on Domain Utility and check if the DNS and Name Server Management service is active, if not, activate it.
If you are activating the DNS management, take a break and come back in a while: Aruba warns you that the operation will take about 60 minutes.
When Aruba has activated the DNS we can click on Manage DNS.
And you will land on the settings page of the Record Name Server. Here you need to click on Use other nameservers.
A pop-up will appear asking how you want to configure Record MX to the new DNS. The default setting is sufficient. You can change it later.
Continue and click on “Manage”.
Enter the first nameserver provided by Cloudflare in the Host box, then click on Add:
Repeat the same operation with the second nameserver provided by Cloudflare. At the bottom, you will see the list of your new nameservers.
Finally, click on Pursue and then click on Save Configuration, and finally on Confirm.
Check nameservers from Cloudflare
We go back to the Cloudflare control panel, specifically to the control panel of the site we are adding to Cloudflare, and picking up where we left off, click Done, check nameservers:
Once we click the Introduction button, we’ll begin a brief configuration:
- Automatic HTTPS rewrites: On
- Automatic minification: check JS/CSS/HTML
After the summary, we can click on Finish.
Back in the Cloudflare control panel, we can now click on Check nameservers. Just wait until Cloudflare has managed to check the nameservers.
At this point we have to wait again, it can take 24 hours for the DNS to change and propagate. You will receive an email when the site is active on Cloudflare.
Once the DNS has been propagated, Cloudflare will start with its job of securing the website.
At this point, the DNS on Aruba has been set up correctly and Cloudflare is already responding with theirs.
We can also check the Response Headers of the page, by opening the browser’s inspector by clicking the right mouse button. Then click Inspect. Now go to the Network tab and check the response headers of the page: check the parameters prefixed with cf (Cloudflare), such as *cf-cache-status:
The cache status of the page on Cloudflare is DYNAMIC and means that the current Cloudflare settings do not explicitly instruct Cloudflare to cache the resource.
On top of that, because we changed the DNS when a user types your domain in the browser, the request is made to Cloudflare, which doesn’t have anything cached yet, so it requests the information from the originating server.
This is because we don’t have any Page Rules set up yet. Therefore the resource was requested by the origin web server (Aruba in this case). It is necessary to use Page Rules to implement some customized caching options, also based on the needs of your site.
To increase the performance of your website, i.e. make it faster and thus improve the user experience, we need to create Page Rules.
Cloudflare provides 3 for each domain with a free Cloudflare account.
In short: Page Rules are settings that trigger certain actions whenever a request matches a URL (or group of URLs) set by the user.
For example, you can instruct Cloudflare to use a more aggressive caching policy, perhaps only for one section of the site, or operate a milder policy by managing the page cache differently.
I’ll end here for now because the article on how to configure Cloudflare for a site on Aruba with Shared Server (a WordPress site or not) is starting to become too long.
However, there is a second part that involves the creation of Page Rules with a view to optimizing the performance of a website.
So, after you have managed to configure Cloudflare for a site on Aruba, you need to configure the correct Page rules. Let’s see here how.