SuaLuna

How to Connect a Domain to Hosting or a Server for Beginners (2 Methods)

T
Tao
8 min read ·

✻ This page may contain affiliate links. If you make a purchase through these links, we may earn a commission at no extra cost to you. We only recommend products we believe will add value to our readers.

Many people use WordPress to build a website. If your domain name and hosting are purchased from different providers, you’ll need to connect the domain to your hosting so your site can run properly online. The same applies if you build your website on a platform like WordPress.com , Shopify , or Ecwid , but your domain comes from another registrar.

Most of the time, you can simply ask the customer support teams of your domain registrar and hosting company for help if you get stuck. But learning how to do it yourself is rewarding — you won’t have to wait for others, and connecting a domain to hosting is not as difficult as you might imagine. Why not follow along and learn today?

Before You Connect a Domain to Hosting

To connect a domain to a hosting plan, you need:

  • A domain name – if you’re not sure where to register one, check here.
  • Web hosting – read our Top 10 Best Web Hosting providers to find a good host.

Connecting your domain to hosting involves configuring settings called DNS records (Domain Name System). There are usually two ways to connect a domain to hosting or an online website building platform.


Method 1: Add an ‘A’ Record to Your DNS Configuration

I’ll use NameSilo as an example. I registered my domains there because it’s affordable, has no hidden fees, and the renewal price for .com domains is the same as the first purchase. Managing multiple domains with one registrar is also convenient.

Step 1. Register a domain name (skip this if you already have one)
Go to NameSilo, type the domain name you want into the search box, and click SEARCH DOMAIN. If it’s available, add it to your cart and proceed to checkout. You can try the coupon code NS01OFF for $1 off your first purchase (check if it’s still valid). NameSilo accepts credit cards, PayPal, Bitcoin, and more. Once you pay, the domain is registered.

Current-Cart-Contents.png

Step 2. Go to DNS configuration
Log into your NameSilo account, find Domain Manager in the sidebar, and click Enter. Click on the domain you just registered, locate DNS Records, and click Update.

Domain-Console.png


The next page is the DNS management page, where you can add and edit records. No matter where you bought your domain, you’ll need to find this DNS settings area.

Step 3. Create records and connect your domain to hosting
On the DNS zone page, you may see some default NameSilo records. I suggest deleting all default records to avoid conflicts, then add new ones.

Manage-DNS.png

To connect your domain, add an A record. Click the blue A in the record type list, and a form will appear:

  • HOSTNAME (the domain or subdomain) → Leave this field blank or enter @ . If you want your website to work with www as well, add a separate A record and put www in this field.
  • IPV4 ADDRESS (your hosting’s public IP address) → Enter the public IPv4 address of your hosting. You can find it on your hosting control panel. Many hosts use cPanel, where the IP is displayed as Shared IP Address (see the cPanel example – I’m using ChemiCloud). Providers like GreenGeeks, SiteGround, and Hostinger have their own panels, but you can always find the IP there or ask customer support.
cPanel-Main-2-1.png
  • TTL (Time to Live) → Set this to 3600 (3600 seconds = 1 hour). NameSilo typically allows 3600. TTL determines how long DNS resolvers cache the record. Propagation can take from a few minutes up to several hours, and sometimes longer. While you can control the TTL value, actual propagation speed also depends on ISPs and other factors.

After filling in all values, click Submit. Now wait for DNS propagation to complete.
How to check if the domain is connected?

  • Visit whatsmydns.net (DNS Propagation Checker), enter your domain, and select the A record type. When all locations show the correct IP, the connection is ready.
DNS-Propagation-Checker-Global-DNS-Testing-Tool-07-08-2026_09_43_PM.jpg
  • You can also open a command prompt (Windows) or terminal (macOS) and type ping yourdomain.com. If it returns your hosting IP address, the connection is successful.

Connecting a Subdomain to Hosting

1. Add an A record
If you want a subdomain like shop.example.com or blog.example.com, you can add another A record. Fill in the subdomain name (e.g., shop or blog) in the HOSTNAME field, and use the same hosting IP address. If you need the subdomain to point to a different server, simply change the IP address. Once the subdomain is connected, you can build a new website just like with your main domain; just make sure the subdomain has its own root directory (cPanel usually creates one automatically when you add a subdomain).

2. Add a CNAME record
You can also connect a subdomain using a CNAME record (canonical name or alias). A CNAME points an alias (e.g., test.example.com) to your main domain (example.com), and since the main domain has an A record pointing to the hosting IP, the alias eventually resolves to the same IP. A CNAME must always point to another domain name, never directly to an IP address.

example.com | A Record | Production Server IP
test.example.com | CNAME | example.com

The advantage of CNAME records: if you ever change hosting providers, you only need to update the main A record — all CNAME-based subdomains will follow automatically. However, because a CNAME lookup requires two DNS queries, there can be a tiny performance impact. For most websites this is negligible, and CNAMEs are widely used for subdomains.


Method 2: Change Your Domain’s Name Servers (NS)

Just as your hosting is managed on a server, your domain’s DNS is controlled by name servers. You can connect your domain to hosting by replacing the default name servers with the ones provided by your hosting company.

When you switch to your host’s name servers, the hosting provider usually configures all necessary DNS records for you automatically. This is why many hosts recommend using their name servers — it simplifies setup and often speeds up propagation when you add new records. It also lets you manage both hosting and DNS in one place.

Domain-Console-1.png

How to change name servers

  1. Still using NameSilo as an example: log into your NameSilo account, go to Domain Manager → select your domain → Name Servers. Click Change, then replace the default name servers with the ones from your hosting provider (each on its own line).
  2. If your domain registrar supports adding NS records in the DNS zone, you can also keep the default name servers and simply add NS records pointing to your hosting provider’s name servers. (For instance, GreenGeeks has a guide on this method.)

Another common scenario is when you use a CDN like Cloudflare. After you change your domain’s name servers to Cloudflare’s, you can manage all your DNS records through the Cloudflare dashboard.


Connecting a Domain to an Email Service (MX Records)

If you purchase a separate email service ( Google Workspace , Microsoft 365, Zoho Mail, etc.), you can set up a professional email address like you@yourdomain.com. To do this, add MX records provided by your email service to your domain’s DNS zone.

ManageDNS-MX.png

For example, using Zoho Mail:

  • HOSTNAME → Leave blank or enter @ (or your domain)
  • ADDRESS/VALUE → Enter the mail server hostname given by your email provider
  • PRIORITY → Usually you’ll see values like 10 and 20 (lower number = higher priority). Some services provide additional levels like 30 or 50.

Each email provider gives specific instructions; please follow theirs. After adding the MX records, wait for propagation just like with A records.


More DNS Record Types

You may see other record types in your DNS zone settings:

  • AAAA – Same function as an A record, but points to an IPv6 address instead of IPv4.
  • TXT/SPF – TXT records store text data and are often used for domain verification (e.g., Google Search Console). They are also used to create SPF records, which help prevent your emails from being marked as spam. Modern email authentication also uses DKIM and DMARC records, which are TXT records as well.
  • SRV – Associates a service with a hostname and port number, often used for VoIP/SIP applications.
  • CAA – Specifies which certificate authorities (CAs) are allowed to issue SSL/TLS certificates for your domain.

When you use a CDN like Cloudflare, you may see additional record types, but most of them you won’t need to touch for a basic website.


Conclusion

Connecting a domain to hosting is actually straightforward. For many beginners or small websites, simply adding an A record (Method 1) is all you need to get online. I wanted to cover several common methods and situations you might run into. In fact, changing name servers is often even easier than adding A records, but if you’re unsure, just reach out to your hosting support.

While this article focuses mainly on traditional hosting, the process is nearly identical if you use a website builder — the only difference is finding the correct IP address or settings provided by that builder. I hope this guide helps you connect your domain and get your website up and running smoothly.

Comments

No comments yet