Introduction
In this guide, we'll explore how to point a domain name to your Ubuntu server using Cloudflare's DNS services. This is a critical step in making your server accessible via a custom domain name. Whether you're purchasing a new domain or using an existing one, this process will ensure your domain correctly routes traffic to your server.
Why Choose Cloudflare for DNS?
While you can use any domain registrar's DNS services, Cloudflare offers significant advantages that make it the preferred choice for professional deployments:
Cloudflare Advantages
Cloudflare's global network ensures your DNS queries are resolved quickly from anywhere in the world, while providing DDoS protection and other security features that typical registrar DNS services cannot match.
Getting Started with Cloudflare
Step-by-Step Setup Process
- Sign up for a free Cloudflare account at cloudflare.com
- Add your domain to Cloudflare using the guided wizard
- Cloudflare will scan your existing DNS records automatically
- Cloudflare will provide you with two nameserver addresses
- Log in to your domain registrar's control panel
- Update the nameservers to those provided by Cloudflare
- Wait for DNS propagation (typically 24-48 hours, but often much faster with Cloudflare)
Domain to Server Connection Flow
Understanding DNS Record Types
For a basic WordPress setup on Ubuntu Server, you need to configure two essential DNS record types:
A Record (Address Record)
An A record maps your domain name directly to your server's IP address. This is the primary record that tells the internet where your server is located.
A Record Example:
| Field | Value | Description |
|---|---|---|
| Type | A | Indicates this is an A record |
| Name | @ | Represents your root domain (e.g., example.com) |
| Content | 192.0.2.1 | Your server's IPv4 address |
| TTL | Auto | Time to Live (how long the record is cached) |
| Proxy Status | DNS only | Direct connection without Cloudflare proxy |
CNAME Record (Canonical Name Record)
A CNAME record creates an alias that points to your domain name. This is commonly used for the "www" subdomain, ensuring that both "example.com" and "www.example.com" point to the same location.
CNAME Record Example:
| Field | Value | Description |
|---|---|---|
| Type | CNAME | Indicates this is a CNAME record |
| Name | www | The subdomain alias |
| Target | example.com | Points to your root domain (not an IP address) |
| TTL | Auto | Time to Live |
| Proxy Status | DNS only | Direct connection without Cloudflare proxy |
Visual DNS Record Configuration
Required DNS Records
A Record
CNAME Record
Configuring DNS Records in Cloudflare
Practical Implementation Steps
-
Access Cloudflare Dashboard
Log in to your Cloudflare account and select your domain from the dashboard -
Navigate to DNS Settings
Click on "DNS" from the left-hand menu to access DNS record management -
Remove Default Records
Delete any existing DNS records that were automatically imported from your previous DNS provider. This ensures a clean slate and prevents conflicts -
Add A Record
Click "Add Record", select type "A", enter "@" or your domain name, input your server's IP address, and set proxy status to "DNS only" -
Add CNAME Record
Click "Add Record" again, select type "CNAME", enter "www" as the name, enter your domain name as the target, and set proxy status to "DNS only" -
Verify Configuration
Double-check that both records show "DNS only" status (gray cloud icon, not orange)
Understanding Proxy Status
DNS Only vs Proxied
| Status | Icon | Behavior | Use Case |
|---|---|---|---|
| DNS Only | ☁️ (Gray Cloud) | Traffic goes directly to your server | Initial setup, SSL configuration |
| Proxied | ☁️ (Orange Cloud) | Traffic routes through Cloudflare | After proper configuration for security & performance |
Why Start with DNS Only?
Starting with "DNS only" mode allows you to:
- Verify that your server is responding correctly
- Configure SSL certificates without Cloudflare interference
- Set up your web server (Nginx) properly
- Test your WordPress installation directly
- Troubleshoot any issues without additional complexity
Real-World Example: expert-wp.help
Case Study Configuration
For the domain expert-wp.help, the DNS configuration would look like this:
Step 1: Select Domain in Cloudflare
Step 2: Navigate to DNS Management
Click "DNS" from the left sidebar menu
Step 3: Remove Existing Records
Delete all auto-imported records from the previous DNS provider
Step 4: Add A Record
| Field | Value |
|---|---|
| Type | A |
| Name | expert-wp.help (or @) |
| IPv4 Address | 203.0.113.42 (example - use your actual server IP) |
| Proxy Status | DNS only (gray cloud) |
Step 5: Add CNAME Record
| Field | Value |
|---|---|
| Type | CNAME |
| Name | www |
| Target | expert-wp.help |
| Proxy Status | DNS only (gray cloud) |
Verification and Testing
How to Verify Your DNS Configuration
After configuring your DNS records, you can verify they're working correctly using various methods:
Expected Results
For A Record Query:
For CNAME Record Query:
Common Mistakes to Avoid
❌ Common Configuration Errors
- Using A record for www: Always use CNAME for www subdomain
- Enabling proxy too early: Keep DNS only status until server is fully configured
- Incorrect IP address: Double-check your server's IP from your hosting provider
- Not removing old records: Delete conflicting records from previous DNS provider
- Typos in domain names: Verify exact spelling, including TLD
Next Steps: Server Stack Installation
Once your DNS is properly configured and propagated, the next phase involves setting up the server software stack that will host and serve your WordPress sites. This includes:
Ubuntu Server Stack Components
Web Server
Database
Scripting Language
Complete Solution
What Each Component Does
| Component | Role | Purpose |
|---|---|---|
| Nginx | Web Server | Receives HTTP requests and serves web pages to visitors |
| MariaDB | Database Management System | Stores WordPress content, settings, and user data |
| PHP 8.3 | Server-Side Scripting Language | Processes WordPress code and generates dynamic content |
Summary Checklist
✓ Complete Configuration Checklist
- Domain registered with your preferred registrar
- Cloudflare account created (free tier is sufficient)
- Domain added to Cloudflare
- Nameservers updated at domain registrar to Cloudflare's nameservers
- All old DNS records removed from Cloudflare
- A record created pointing to server IP address
- CNAME record created for www subdomain
- Both records set to "DNS only" proxy status
- DNS propagation verified using nslookup or dig
- Ready to proceed with LEMP stack installation
Conclusion
Proper DNS configuration is the foundation of a successful web hosting setup. By using Cloudflare's DNS services and following the correct procedures for creating A and CNAME records, you've established a reliable connection between your domain name and Ubuntu server. The "DNS only" proxy status ensures that you can complete the necessary server configuration without interference, and you'll be able to enable Cloudflare's advanced security and performance features later once everything is properly set up.
Remember that DNS changes can take time to propagate across the internet, though Cloudflare's network typically ensures much faster propagation than traditional DNS providers. With your DNS properly configured, you're now ready to move forward with installing Nginx, MariaDB, and PHP 8.3 to create a complete hosting environment for WordPress.