Introduction

This article is part of the Hexo blog setup guide series V1.2, which mainly introduces the process of registering a custom domain for a Hexo blog on Namecheap and using Cloudflare for DNS resolution. The entire blog setup guide series can be found at: Hexo Blog Building Guide: Systematic Solutions and Detailed Construction Process.

Overall Process:

  • The process is as follows:

The overall process

Explanation:

  • It includes three stages: Preparation, Domain Registration, and Domain Resolution, involving two modules: Namecheap and Cloudflare.

Preparation

  • Register for Namecheap
  • Register for Cloudflare

Domain Registration

Search for Domain

  • Log in to your Namecheap account, enter the domain you want to register in the search box, and check its availability. If it is already taken, it will show as (TAKEN). If available, the domain will display the price and an “Add to Cart” button.

Search Domain

Purchase Domain

  • For available domains that meet personal needs, click “Add to Cart“ to add it to your shopping cart.
  • Click “Checkout” to proceed to the order confirmation page, select the registration period (usually 1 year), and enable domain privacy protection (recommended).
    • Select registration period (usually 1 year).
    • For Domain Privacy, which hides the real owner’s identity in domain information, effectively protecting the registrant’s privacy. This service is currently free and is recommended to be enabled.
    • AUTO-RENEW means automatic renewal after the domain expires; it is recommended to enable this option.
      • Enabling auto-renewal helps avoid the risk of domain expiration and being snatched by others due to forgetting manual renewal.
    • Promo Code allows you to enter discount codes.
  • Click “Confirm Order” and fill in payment information (supports credit card and PayPal).
  • After payment is completed, you will receive a confirmation email and need to verify your email according to the instructions in the email.

Purchase Domain

Domain Resolution

Add Domain to Cloudflare

  • After logging into Cloudflare, click the “Add Site” button.
  • Enter the domain you purchased from Namecheap and click “Continue.”
  • Choose an appropriate plan (usually select the free plan) and continue.

Add Domain

Obtain Cloudflare Name Servers

  • Cloudflare will automatically scan your domain records and display suggested DNS records.
  • Cloudflare will provide two new name server (NS) addresses. Make a note of these addresses as you will use them in Namecheap.

Obtain Cloudflare Name Servers

Change Name Servers

(1) Purpose

The core purpose of changing name servers is to transfer DNS management rights of the domain to Cloudflare.

  • Activate Cloudflare services: By changing the name servers to those of Cloudflare, you make Cloudflare your authoritative DNS provider for your domain. This means all DNS requests will be processed through Cloudflare first.
  • Utilize Cloudflare features: This allows you to take advantage of various services provided by Cloudflare, such as website acceleration, traffic protection, SSL encryption, etc.
  • Centralized DNS record management: In Cloudflare, you can conveniently manage all DNS records without switching between Namecheap and Cloudflare.

(2) Specific Steps

  • Log into your Namecheap account:
  • Find your domain:
    • In the left menu, select “Domain List” and find the domain you want to configure (e.g., dmindie.com).
  • Manage domain settings:
    • Click the “Manage” button next to that domain.
  • Change name servers:
    • In the “Nameservers” section, select “Custom DNS.”
    • Enter the name servers provided by Cloudflare (usually two, such as ns1.cloudflare.com and ns2.cloudflare.com).
    • Click save (checkmark) to apply changes.
  • Wait for DNS updates:
    • After changing name servers, it may take some time (usually a few hours up to 48 hours) for changes to fully take effect. During this time, you can use DNS checking tools (like dnschecker.org) to verify if the name servers have been updated.

Change Name Servers

Configure DNS Records

  • Return to the Cloudflare dashboard and go to the “DNS” tab.
  • Add or modify DNS records as needed, such as A records or CNAME records, to ensure your domain points to the correct server IP address.
  • For example: My blog is hosted at blog.dmindie.com, which is hosted on cloudflarepages: your-project-name.pages.dev.
    • Type: CNAME
    • Name: blog (indicating subdomain blog.dmindie.com)
    • Target: Enter the alias domain of your hosted blog, such as your-project-name.pages.dev.
    • Proxy status: It is recommended to enable this (orange cloud icon) to utilize Cloudflare’s CDN and security features.

If my blog is hosted at dmindie.com, which is hosted on cloudflarepages: your-project-name.pages.dev.

  • Name: @ (indicating root domain dmindie.com).
  • Target: Enter the alias domain of your hosted blog, such as your-project-name.pages.dev.
  • Proxy status: It is recommended to enable this (orange cloud icon).

Common record types include:

  • A Record
    • Purpose: Maps a domain name to an IPv4 address.
    • Example: When a user enters a domain name, an A record provides the corresponding IP address so that browsers can find and load the website.
  • AAAA Record
    • Purpose: Maps a domain name to an IPv6 address.
    • Example: Similar to an A record but used for supporting more modern IPv6 addresses.
  • CNAME Record
    • Purpose: Points one domain name to another (alias).
    • Example: Can be used to point www.example.com to example.com, so users accessing www subdomain are actually visiting root domain.

In addition, there are MX records, NS records, etc., each serving specific purposes.

Configure DNS Records

Verify Resolution Results

  • DNS configurations typically take a few minutes up to 48 hours to take effect. After waiting patiently, you can proceed with testing verification.
  • You can use DNS checking tools (like dnschecker.org) to verify if your domain has successfully resolved through Cloudflare.
    • Enter your domain, e.g., yourdomain.com
    • Select NS record type for searching
    • If resolution is successful, it will appear as shown in the following image:

Verify Resolution Results

You can visit the target address https://blog.dmindie.com/ for verification. If everything is set correctly, you should see your website’s content.

Verify Resolution Results

Conclusion

In this article, we detailed how to register a domain through Namecheap and use Cloudflare for domain resolution. If you encounter any questions or confusion during this process, feel free to leave comments or messages; I would be more than happy to provide assistance and support!