After buying a domain name and a web hosting plan, the next step is connecting them.
Your domain name is the address visitors type into their browser, while your hosting account is where your website files are stored. Until the domain points to the hosting server, visitors will not be able to access your website correctly.
This guide explains how to connect a domain to web hosting using nameservers or DNS records.
What Does It Mean to Connect a Domain to Hosting?
A domain name and a hosting account can be purchased from the same company or from different providers.
For example, you may buy:
Your domain from one provider
Your hosting from Ceylon Web Servers
In that case, you need to tell the domain where your website is hosted.
This is done through DNS.
DNS stands for Domain Name System. It connects your domain name to the IP address of your hosting server.
What Information Do You Need?
Before changing any settings, collect the details provided by your hosting company.
You may receive:
Nameserver 1
Nameserver 2
Server IP address
Hosting account details
Control panel login information
Nameservers may look similar to:
ns1.example.com
ns2.example.comA server IP address may look similar to:
192.0.2.10Use the exact information provided with your hosting account.
Method 1: Connect Your Domain Using Nameservers
Changing nameservers is one of the easiest ways to connect a domain to a hosting account.
When you use your hosting provider's nameservers, DNS management is normally handled through the hosting platform.
Step 1: Find Your Hosting Nameservers
Check your hosting welcome email or client area.
Look for information such as:
Nameserver 1: ns1.example.com
Nameserver 2: ns2.example.comCopy both nameservers exactly.
Step 2: Log In to Your Domain Provider
Log in to the website where your domain is registered.
Find your domain and open its management settings.
Look for an option such as:
Nameservers
DNS
Manage Domain
Custom Nameservers
Domain Settings
The wording may vary depending on the registrar.
Step 3: Select Custom Nameservers
Choose the option to use custom nameservers.
Remove the old nameservers if necessary and enter the new nameservers provided by your hosting provider.
For example:
ns1.example.com
ns2.example.comSave the changes.
How Long Do Nameserver Changes Take?
DNS changes are not always visible immediately.
Some changes may appear quickly, while full DNS propagation can take longer depending on the registrar, DNS provider, internet service provider, and existing cached records.
During this period, some visitors may see the old website while others see the new hosting server.
Avoid making repeated DNS changes while propagation is still taking place unless you know the current configuration is incorrect.
Method 2: Connect a Domain Using an A Record
You do not always need to change nameservers.
If you want to keep your DNS management with your current domain provider, you can point the domain to your hosting server using an A record.
You need the IP address of your hosting server.
Step 1: Find Your Server IP Address
Your hosting provider should provide a server IP address.
For example:
192.0.2.10Do not use this example IP. Use the actual IP provided with your hosting service.
Step 2: Open DNS Management
Log in to your domain provider.
Open the DNS management section for your domain.
Step 3: Create or Edit the Main A Record
Look for an A record with the host or name:
@The @ symbol usually represents your main domain.
Set the value to your hosting server's IP address.
Example:
Type: A
Name: @
Value: 192.0.2.10Step 4: Configure the WWW Version
You also need to make sure:
www.yourdomain.comworks correctly.
One common configuration is a CNAME record:
Type: CNAME
Name: www
Value: yourdomain.comAnother configuration may use an A record pointing www to the same server IP.
Use the setup recommended by your hosting provider.
Nameservers vs A Records
Both methods can connect your domain to your hosting.
Use Nameservers When:
You want your hosting provider to manage DNS
You prefer a simpler setup
Your hosting provider gives you nameservers
You do not need to keep DNS with another service
Use A Records When:
You want to keep DNS with your domain registrar
You use a third-party DNS provider
You use services such as external email
You want more control over individual DNS records
Do not change nameservers just because you want to update one A record. Choose the method that matches your existing setup.
What Is an A Record?
An A record connects a domain or subdomain to an IPv4 address.
For example:
yourdomain.com → 192.0.2.10It tells visitors which server should receive requests for that domain.
A records are commonly used for:
Main websites
Subdomains
Server panels
Applications
API endpoints
What Is a CNAME Record?
A CNAME record points one hostname to another hostname.
For example:
www.yourdomain.com → yourdomain.comInstead of entering an IP address directly, the CNAME refers to another domain name.
CNAME records are commonly used for:
www
Blog subdomains
External platforms
SaaS services
Verification records
What Is an MX Record?
MX records control where email for your domain is delivered.
For example:
[email protected]depends on the correct MX records.
Be careful when changing nameservers if your business email is hosted with another provider.
Changing nameservers without recreating the correct MX records may cause email problems.
Before making DNS changes, check whether your domain already uses services such as:
Business email
Google Workspace
Microsoft 365
External mail servers
Email marketing platforms
Keep the necessary DNS records if those services must continue working.
What Is TTL?
TTL stands for Time to Live.
It tells DNS servers how long they should keep a DNS record cached before checking for an updated version.
You may see values such as:
300
3600
14400A lower TTL can sometimes help when planning DNS changes, but you normally do not need to modify it for a basic hosting setup.
If you are unsure, leave the default TTL value provided by your DNS platform.
How to Connect a Subdomain to Hosting
A subdomain is an address such as:
shop.yourdomain.comor:
app.yourdomain.comYou can point a subdomain to a server using an A record.
For example:
Type: A
Name: app
Value: Your Server IPYou can also use a CNAME when the destination is another hostname.
Subdomains are useful for:
Web applications
Customer portals
APIs
Admin panels
Staging websites
Blogs
How to Check Whether Your Domain Is Connected
After updating DNS, open your domain in a browser.
For example:
https://yourdomain.comIf your website appears, the connection is working.
You can also check whether the domain resolves to the correct server IP using DNS lookup tools.
If the old server still appears, DNS propagation may not be complete.
Website Shows a Default Hosting Page
If your domain opens but displays a default hosting page, DNS may already be working.
The problem may be that your website files have not been uploaded yet.
Open your hosting File Manager and check the main website directory.
Depending on your hosting environment, it may be called:
public_htmlMake sure your main website file exists.
For an HTML website:
index.htmlFor a PHP website:
index.phpDomain Is Connected but Website Does Not Open
If your domain points to the server but the website still does not work, check the following.
Check the Domain in Your Hosting Account
Make sure the domain has been added to your hosting account.
The server needs to know which hosting account should respond when someone visits the domain.
Check the Document Root
Make sure the domain points to the correct website folder.
Check Your Website Files
Confirm that the website files are uploaded to the correct directory.
Check DNS Records
Make sure the A record points to the correct server IP.
Check SSL
If the browser is trying to open HTTPS but SSL has not been configured, you may see a certificate warning or connection problem.
How to Enable SSL After Connecting Your Domain
Once the domain points to your hosting server, you can normally enable SSL.
SSL allows your website to use:
https://yourdomain.cominstead of:
http://yourdomain.comAfter SSL is installed, test both:
https://yourdomain.com
https://www.yourdomain.comif you plan to use both versions.
You should also configure your website so visitors are redirected to the preferred HTTPS version.
Common DNS Mistakes
Entering the Wrong Server IP
Double-check the server IP before saving your A record.
One incorrect number can send visitors to the wrong server.
Using Old Nameservers
Make sure you are using the nameservers supplied for your current hosting account.
Deleting Email Records
Do not delete MX, SPF, DKIM, or other email-related records unless you understand their purpose.
Removing them may stop your email service from working correctly.
Creating Conflicting Records
Avoid creating multiple conflicting A or CNAME records for the same hostname unless your setup specifically requires them.
Adding HTTP or HTTPS to DNS Records
DNS records usually contain hostnames or IP addresses.
Do not enter:
https://yourdomain.comas the value of a standard A record.
An A record requires an IP address.
Entering the Full Domain in the Wrong Field
Some DNS providers automatically append your domain name.
If the interface asks for only the host name and you enter:
www.yourdomain.comit could potentially create an incorrect record.
Follow the format shown by your DNS provider.
Can I Use Cloudflare With My Hosting?
Yes, many websites use third-party DNS or proxy services such as Cloudflare.
In that setup, you normally keep the nameservers provided by the DNS service and configure your hosting server's IP address within that service.
You do not normally switch to the hosting company's nameservers if you want the third-party DNS service to remain in control.
Make sure the origin server IP, SSL mode, and DNS records are configured correctly.
Do I Need to Change Nameservers If My Domain and Hosting Are With the Same Company?
Not always.
If your hosting provider automatically configures the domain and hosting together, DNS may already be set up.
Check your client area before changing anything.
If the website is already resolving correctly, unnecessary DNS changes can create problems.
Frequently Asked Questions
How do I point my domain to my hosting?
You can usually point your domain by changing its nameservers or by updating its A record to your hosting server's IP address.
How long does DNS propagation take?
DNS changes can take time to update across different networks. Some users may see the new server before others while cached records are being refreshed.
Can I buy my domain and hosting from different companies?
Yes.
You can register your domain with one provider and use hosting from another provider.
You only need to configure the DNS correctly.
Can I change hosting without changing my domain?
Yes.
Keep your existing domain and update its DNS so it points to the new hosting server.
Will changing nameservers affect my email?
It can.
If your email uses specific MX or other DNS records, make sure those records exist on the new DNS service before or immediately after switching nameservers.
Why does my website still show the old server?
Your DNS may still be cached.
Check that your new records are correct and allow time for the updated DNS information to reach different networks.
Do I need technical knowledge to connect a domain?
Basic domain connection can usually be done through your domain provider's DNS or nameserver settings.
If you are unsure about existing email or other DNS records, ask your hosting provider before changing them.
Connect Your Domain with Ceylon Web Servers
Ceylon Web Servers provides hosting solutions for websites, businesses, developers, and online projects in Sri Lanka.
Available services include:
Shared Hosting
Reseller Hosting
VPS Hosting
Domain-related services
Need help connecting your domain to your hosting account?
Website: ceylonwebservers.com
Call / WhatsApp: 070 244 7722