4 Steps To Setup Cloudflare CDN In Magento 2
Content Delivery Network (CDN) is a global server system which serves content to the users via a global network of data centers. Cloudflare CDN is one of the largest CDN providers in the world. With the support of Cloudflare CDN, the distance between the content and users is minimized. As a result, Cloudflare CDN helps businesses reach global audiences more cost-effectively.
Recommend: 4 Steps To Setup Amazon CloudFront CDN In Magento 2
Hence, in this article, I will instruct you to setup Cloudflare CDN in Magento 2 through 4 steps as below:
- Step 1: Create A Cloudflare Account And Add Your Domain Name
- Step 2: Point Your Domain Nameservers To Cloudflare
- Step 3: Configure CloudFlare to server
- Step 4: Install the Cloudflare module for Magento 2
Step 1: Create A Cloudflare Account And Add Your Domain Name
Access to here, and then click to the Sign Up button to create a Cloudflare account.
Enter your email and password into the Email and Password field, then click to the Create Account button
After creating your CloudFlare CDN account successfully, enter your domain name on the site field and click to Add site button.
Then, please follow the Cloudflare’s instruction to beginning the configuration process.
Step 2: Point Your Domain Nameservers To Cloudflare
Access the domain management page and change your nameservers (DNS) to Cloudflare following the instruction. In our example, the 2 DNS need to be pointed to:
- kiki.ns.cloudflare.com
- oswald.ns.cloudflare.com
Step 3: Configure CloudFlare to server
- In CloudFlare, access the CND tab
-
Fill the DNS Records needed pointing to the server’s IP Note:
- Firstly, you must enable Cloudflare (the yellow cloud icon) to use CDN of CloudFlare.
- Secondly, when CDN is turned on, the IP will be changed. Hence, in case that the SSL of the server is turned on, it is unable for you to use CDN from Cloudflare, and the website will show an error notification.
To solve this problem, you can use the Cloudflare’s SSL at Crypto tab:
Step 4: Install the Cloudflare module for Magento 2
- You need to buy Cloudflare module on Marketplace and then set up Module via Composer.
- Path of the Module on Marketplace is
cloudflare/cloudflare-magento
- Access the SSH and find root folder of Magento
- Type this command:
composer require cloudflare/cloudflare-magento:1.1.3
Note: Replacing 1.1.3
with the version of Magento which you offered from Marketplace.
- After setting up Cloudflare successfully, access the Admin panel:
Login to Cloudflare at Module’s Config, click to the View button to get API Key.
Alright, we have completed the installation and configuration process of Cloudflare in Magento 2. To be supported with more advanced functions, you should buy the Pro version from Cloudflare.
Conclusions
Above is the detail instructions to setup Cloudflare in Magento 2. In case you have questions on any steps, don’t hesitate to ask us. Implementing CloudFlare CDN is the smartest way to enhance your website performance and speed. Furthermore, with over four years of experience in developing Magento extensions, we are here to facilitate more advanced features for your store. Let’s Mageplaza help you to grow your store right now!
Abandoned cart email.

Recent Tutorials

Magento 2 Admin Panel
6 Steps to Creating an Extension Package File in Magento
How to build landing pages in Magento store?
Comments for 4 Steps To Setup Cloudflare CDN In Magento 2
Explore Our Products:
People also searched for
- cloudflare magento 2
- magento 2 cloudflare
- cloudflare cdn magento 2
- magento 2 cloudflare cdn
- cloudflare magento
- magento cloudflare
- cloudflare cdn setup
- cloudflare com login
- cloudflare tutorial
- how to setup cloudflare cdn
- cloudfare cdn
- magento2 cloudflare
- how to setup cloudflare
- cloudflare create account
- 2.2.x, 2.3.x, 2.4.x
Stay in the know
Get special offers on the latest news from Mageplaza.
Earn $10 in reward now!