Uncategorized

How to Point a Subdomain to a Server 2026

0

How to Point a Subdomain to a Server is an essential skill for website owners, developers, freelancers, and beginners who manage domains and hosting.

A subdomain allows you to create a separate address under your main domain. For example, if your primary website is:

https://example.com

you could create:

https://blog.example.com
https://shop.example.com
https://app.example.com
https://staging.example.com

Each subdomain can point to a different server, application, hosting account, or service.

For example:

example.com
      ↓
Main Website Server

app.example.com
      ↓
Application Server

staging.example.com
      ↓
Staging Server

The process of How to Point a Subdomain to a Server mainly involves configuring DNS and then configuring the destination server to respond to that hostname.

Many beginners think that creating a subdomain in a hosting panel automatically connects it to a server. In reality, DNS tells the internet where the subdomain should resolve, while the web server must also know what content to serve when that hostname is requested.

This guide explains How to Point a Subdomain to a Server step by step, including A records, CNAME records, DNS propagation, Apache and Nginx configuration, HTTPS, troubleshooting, and security best practices.


What Is a Subdomain?

Before learning How to Point a Subdomain to a Server, you need to understand what a subdomain is.

A domain can have multiple levels.

For example:

example.com

is the main domain.

A subdomain could be:

blog.example.com

Here:

blog

is the subdomain.

Another example:

api.example.com

where:

api

is the subdomain.

Common subdomains include:

SubdomainTypical Purpose
wwwMain website
blogBlog
shopE-commerce
appWeb application
apiAPI
stagingTesting environment
mailMail-related services

Learning How to Point a Subdomain to a Server allows you to connect these hostnames to the infrastructure that should handle them.


How Does Pointing a Subdomain to a Server Work?

To understand How to Point a Subdomain to a Server, consider this simplified process:

User enters:
https://app.example.com
          ↓
DNS Lookup
          ↓
DNS Record
          ↓
Server IP / Hostname
          ↓
Web Server
          ↓
Application
          ↓
Website Response

There are actually two separate configurations:

DNS Configuration

DNS determines where:

app.example.com

should resolve.

Server Configuration

The destination server determines what it should do when it receives a request for:

app.example.com

Both parts must be configured correctly.

If DNS is correct but the server does not recognize the hostname, you may receive:

  • 404 errors.
  • Default website.
  • 403 errors.
  • Connection errors.
  • Incorrect website content.

Therefore, How to Point a Subdomain to a Server requires both DNS and server configuration.


How to Point a Subdomain to a Server Step by Step

The general process for How to Point a Subdomain to a Server is:

  1. Identify your DNS provider.
  2. Identify the destination server.
  3. Obtain the server IP address or hostname.
  4. Create the appropriate DNS record.
  5. Configure the destination web server.
  6. Enable HTTPS.
  7. Test DNS resolution.
  8. Test the website.
  9. Troubleshoot propagation or configuration issues.

Let’s examine each step.


Step 1: Identify Your DNS Provider

The first step in How to Point a Subdomain to a Server is finding where your domain’s DNS is managed.

Your DNS could be managed by:

  • Domain registrar.
  • Hosting provider.
  • Cloudflare.
  • AWS Route 53.
  • Google Cloud DNS.
  • Another DNS provider.

You can identify authoritative nameservers using:

dig example.com NS +short

or:

nslookup -type=NS example.com

For example:

ns1.example-dns.com
ns2.example-dns.com

These nameservers tell you which DNS infrastructure is authoritative for the domain.

You must add the subdomain record in the DNS system that actually manages the domain’s authoritative zone.


Step 2: Identify the Destination Server

Before learning How to Point a Subdomain to a Server, determine where the subdomain should go.

Suppose you have:

Main website:
example.com

Application:
app.example.com

Your application server might have:

203.0.113.25

You could then point:

app.example.com
        ↓
203.0.113.25

If your hosting provider gives you a hostname instead of an IP address, you may need to use a CNAME.

For example:

app.example.com
        ↓
app-host.example.net

Ask your hosting provider for the correct destination if you are unsure.


Step 3: Choose Between an A Record and CNAME Record

This is one of the most important concepts in How to Point a Subdomain to a Server.

A Record

An A record maps a hostname to an IPv4 address.

For example:

Type: A
Name: app
Value: 203.0.113.25

This creates:

app.example.com → 203.0.113.25

Use an A record when you need to point the subdomain directly to an IPv4 address.


CNAME Record

A CNAME record maps one hostname to another hostname.

For example:

Type: CNAME
Name: app
Value: app-host.example.net

This means:

app.example.com
       ↓
app-host.example.net

The target hostname then resolves to an IP address.

A CNAME is useful when a service provider gives you a hostname instead of a fixed IP.


A Record vs CNAME

FeatureA RecordCNAME
Points toIPv4 addressHostname
Example203.0.113.25app.host.com
Common useDedicated serverManaged service
IP changesMust update recordTarget can change
IPv6Use AAAA insteadCan point to hostname

Choosing the correct record is an important part of How to Point a Subdomain to a Server.


Step 4: Create the DNS Record

Now create the DNS record.

Suppose your domain is:

example.com

and your server IP is:

203.0.113.25

You could create:

Type: A
Name: app
Value: 203.0.113.25
TTL: 3600

The result is:

app.example.com → 203.0.113.25

Some DNS providers ask for the full hostname:

app.example.com

while others require only:

app

Follow your DNS provider’s interface instructions.


Step 5: Understand DNS TTL

TTL means Time To Live.

It controls how long DNS resolvers may cache a response.

For example:

app.example.com 3600 IN A 203.0.113.25

The value:

3600

means 3,600 seconds, or approximately one hour.

When learning How to Point a Subdomain to a Server, remember that DNS changes may not appear everywhere immediately because recursive resolvers can cache previous responses.

Before a planned migration, lowering the TTL ahead of time can help reduce the period during which old DNS information remains cached.

However, changing the TTL after a record has already been cached does not necessarily immediately remove the old cached answer.

For more information, see the Cloudflare DNS TTL documentation.


Step 6: Verify DNS Resolution

After creating the record, check whether the subdomain resolves correctly.

Use:

dig app.example.com A

For a shorter result:

dig app.example.com A +short

You should see:

203.0.113.25

You can also use:

nslookup app.example.com

The response should show the expected IP address.

If you use a CNAME:

dig app.example.com CNAME

You can also check the final address:

dig app.example.com A +short

This is an essential step in How to Point a Subdomain to a Server because it confirms that DNS is returning the expected destination.


Step 7: Configure the Web Server

DNS only tells the browser which server to contact.

The server must also know how to handle:

app.example.com

This is commonly done using the HTTP Host header and server configuration.

If you are using Apache or Nginx, configure a virtual host or server block for the subdomain.


How to Point a Subdomain to a Server Using Apache

For Apache, you can configure a virtual host.

Example:

<VirtualHost *:80>
    ServerName app.example.com
    DocumentRoot /var/www/app

    <Directory /var/www/app>
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/app-error.log
    CustomLog ${APACHE_LOG_DIR}/app-access.log combined
</VirtualHost>

The important part is:

ServerName app.example.com

This tells Apache which hostname this configuration handles.

The document root:

/var/www/app

contains the website files for the subdomain.

After configuring Apache, test the configuration:

apachectl configtest

If the configuration is valid, reload Apache.

On systems using systemd:

sudo systemctl reload apache2

The exact service name can vary by operating system.


How to Point a Subdomain to a Server Using Nginx

For Nginx, create a server block.

Example:

server {
    listen 80;
    server_name app.example.com;

    root /var/www/app;
    index index.html index.php;

    location / {
        try_files $uri $uri/ =404;
    }
}

The important line is:

server_name app.example.com;

This tells Nginx which hostname the server block should handle.

After editing the configuration:

sudo nginx -t

If the test succeeds:

sudo systemctl reload nginx

You can then visit:

http://app.example.com

Step 8: Configure HTTPS

When learning How to Point a Subdomain to a Server, do not stop after HTTP works.

Your subdomain should generally use HTTPS:

https://app.example.com

You need a TLS certificate that covers:

app.example.com

You can obtain a certificate through your hosting provider or a certificate authority such as Let’s Encrypt.

After installing the certificate, configure your web server to listen on port 443.

A simplified Nginx example:

server {
    listen 443 ssl;
    server_name app.example.com;

    ssl_certificate /path/to/certificate.crt;
    ssl_certificate_key /path/to/private.key;

    root /var/www/app;
}

The exact TLS configuration should follow current security recommendations for your server and operating system.

You can learn more about HTTPS in your related article:

How to Enable HTTPS on a Website


Step 9: Redirect HTTP to HTTPS

Once HTTPS is working, redirect HTTP requests.

For Nginx:

server {
    listen 80;
    server_name app.example.com;

    return 301 https://$host$request_uri;
}

This means:

http://app.example.com
        ↓
https://app.example.com

For Apache, you can use a rewrite rule:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Test the redirect carefully to make sure it does not create a redirect loop.


How to Point a Subdomain to a Different Server

One of the most common reasons for learning How to Point a Subdomain to a Server is connecting a subdomain to a completely different server.

For example:

example.com
    ↓
Server A
203.0.113.10

app.example.com
    ↓
Server B
203.0.113.20

The DNS zone could contain:

example.com       A    203.0.113.10
app.example.com   A    203.0.113.20

This allows the main website and application to run on separate infrastructure.

Another example:

example.com
    ↓
Main Hosting

api.example.com
    ↓
API Server

staging.example.com
    ↓
Staging Server

This is a common architecture for modern websites.


How to Point a Subdomain to a VPS

If you have a VPS, How to Point a Subdomain to a Server generally involves two parts.

DNS

Create:

Type: A
Name: app
Value: YOUR_VPS_IP

For example:

app.example.com → 203.0.113.25

VPS

Configure your web server:

server_name app.example.com;

or:

ServerName app.example.com

Then configure your application and HTTPS.

The DNS record alone will not automatically install or configure the application on your VPS.


How to Point a Subdomain to a Node.js Server

Suppose your Node.js application runs on:

localhost:3000

You generally should not expose port 3000 directly as the public website URL.

Instead, use a reverse proxy such as Nginx.

The architecture becomes:

Browser
   ↓
https://app.example.com
   ↓
Nginx :443
   ↓
Node.js :3000

Example Nginx configuration:

server {
    listen 443 ssl;
    server_name app.example.com;

    ssl_certificate /path/to/certificate.crt;
    ssl_certificate_key /path/to/private.key;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

This allows visitors to access the application through:

https://app.example.com

while Node.js runs internally on port 3000.


How to Point a Subdomain to a WordPress Website

WordPress can also use subdomains.

For example:

blog.example.com

could host a separate WordPress installation.

The process is:

  1. Create the DNS record.
  2. Create the subdomain in hosting.
  3. Configure the document root.
  4. Install WordPress.
  5. Configure the WordPress URL.
  6. Enable HTTPS.
  7. Test the website.

The WordPress URL should match:

https://blog.example.com

rather than the main domain if this is a separate installation.

If you are creating a staging environment, see your related guide How to Set Up a Staging Subdomain.


How to Point a Subdomain to a Cloud Server

Cloud platforms often provide a hostname or IP address for your service.

The general process is:

Subdomain
    ↓
DNS Record
    ↓
Cloud Load Balancer / Server
    ↓
Application

For example:

api.example.com
        ↓
Load Balancer
        ↓
Application Servers

If the cloud provider gives you a hostname, use the CNAME record they specify.

If it provides a stable public IPv4 address, an A record may be appropriate.

Follow the cloud provider’s documentation because some services require specific DNS records for domain verification.


Common Problems When Pointing a Subdomain to a Server

Understanding common problems makes How to Point a Subdomain to a Server much easier.

1. DNS Does Not Resolve

If:

dig app.example.com

returns no useful answer, check:

  • DNS record.
  • Nameservers.
  • DNS provider.
  • Hostname spelling.
  • Record type.
  • TTL.

2. DNS Points to the Wrong IP

Run:

dig app.example.com A +short

If the result is not your server’s IP address, correct the DNS record.


3. DNS Is Correct but the Wrong Website Appears

This usually means the web server is not configured correctly.

Check:

server_name

in Nginx or:

ServerName

in Apache.

Also check the document root.


4. HTTPS Certificate Error

Make sure the TLS certificate includes:

app.example.com

A certificate for only:

example.com

does not necessarily cover every subdomain.

A wildcard certificate such as:

*.example.com

can cover many direct subdomains, subject to certificate and provider rules.


5. 404 Error

A 404 error may indicate:

  • Wrong document root.
  • Missing application route.
  • Incorrect virtual host.
  • Application configuration problem.

DNS can be completely correct while the web application still returns 404.


6. 403 Forbidden

A 403 may result from:

  • Incorrect file permissions.
  • Web-server access rules.
  • Directory restrictions.
  • Application-level authorization.

Check your server logs.


7. Connection Refused

If DNS resolves correctly but the server refuses the connection, check:

  • Web server status.
  • Firewall.
  • Port 80.
  • Port 443.
  • Cloud security groups.
  • Reverse proxy.
  • Application status.

How to Troubleshoot DNS Propagation Problems

If you recently created the subdomain and it is not working, you may be dealing with DNS caching.

Run:

dig app.example.com A +short

Then query public resolvers:

dig @1.1.1.1 app.example.com A +short

and:

dig @8.8.8.8 app.example.com A +short

If different resolvers return different results, cached DNS information may still exist.

However, do not automatically assume that every DNS issue is propagation.

First check the authoritative DNS server.

You can learn more in your related article:

How to Troubleshoot DNS Propagation Problems


How to Verify the Authoritative DNS Server

To determine which nameservers are authoritative:

dig example.com NS +short

Then query one of them directly:

dig @ns1.example.com app.example.com A

If the authoritative server returns the correct IP address, your DNS provider is publishing the expected record.

If the authoritative server returns the wrong value, waiting for propagation will not solve the problem.

You need to correct the DNS configuration.


Security Best Practices for Subdomains

Learning How to Point a Subdomain to a Server also means understanding subdomain security.

Use HTTPS

Secure communication with TLS.

Keep DNS Accurate

Remove unused DNS records.

Protect Sensitive Subdomains

Administrative applications should not be exposed unnecessarily.

Use Authentication

For private applications, require appropriate authentication.

Avoid Exposing Development Systems

Do not assume a subdomain such as:

dev.example.com

is secret.

Keep Software Updated

Update operating systems, web servers, frameworks, CMS platforms, and dependencies.

Use Security Headers

Configure appropriate security headers for web applications.

Monitor DNS Changes

Unexpected DNS changes can indicate account compromise or configuration problems.


Subdomain DNS Record Examples

Here are common examples to help beginners understand How to Point a Subdomain to a Server.

Application Server

Type: A
Name: app
Value: 203.0.113.25

Result:

app.example.com → 203.0.113.25

API Server

Type: A
Name: api
Value: 203.0.113.30

Result:

api.example.com → 203.0.113.30

Staging Server

Type: A
Name: staging
Value: 203.0.113.40

Result:

staging.example.com → 203.0.113.40

Managed Service

Type: CNAME
Name: app
Value: service.provider.example

Result:

app.example.com → service.provider.example

How Long Does It Take to Point a Subdomain?

DNS changes do not necessarily become visible everywhere immediately.

The time depends on:

  • DNS TTL.
  • Recursive resolver caches.
  • DNS provider.
  • Nameserver configuration.
  • Local DNS cache.
  • ISP caching.

A newly created subdomain may become visible quickly, but you should not rely on a fixed number of minutes or hours.

The best way to determine whether the configuration is working is to query the authoritative nameserver and compare results from multiple recursive resolvers.

This is an important part of How to Point a Subdomain to a Server because it prevents you from repeatedly changing a correct DNS record.


How to Point a Subdomain to a Server Checklist

Use this checklist when implementing How to Point a Subdomain to a Server:

  • Identify the DNS provider.
  • Identify the authoritative nameservers.
  • Identify the destination server.
  • Get the correct IPv4 address or hostname.
  • Choose A or CNAME.
  • Create the DNS record.
  • Check TTL.
  • Query the DNS record.
  • Verify the authoritative response.
  • Configure Apache, Nginx, or your hosting platform.
  • Configure the correct document root.
  • Enable HTTPS.
  • Install a valid TLS certificate.
  • Redirect HTTP to HTTPS.
  • Test the application.
  • Check server logs.
  • Test from multiple networks.
  • Remove unused records.
  • Protect sensitive applications.
  • Monitor the subdomain.

Frequently Asked Questions

What does it mean to point a subdomain to a server?

It means creating a DNS record that tells DNS resolvers where a subdomain should resolve, usually to an IP address or another hostname.

Can a subdomain point to a different server?

Yes. For example, example.com can point to one server while app.example.com points to another.

Should I use an A record or CNAME?

Use an A record when pointing directly to an IPv4 address. Use a CNAME when your service provider gives you another hostname as the destination.

Can I point a subdomain to a VPS?

Yes. Create an A record pointing the subdomain to the VPS’s public IPv4 address and configure the web server to respond to that hostname.

Does DNS automatically configure my web server?

No. DNS only directs traffic toward the destination. Your web server must also be configured to handle the subdomain.

Can I use HTTPS on a subdomain?

Yes. The subdomain should have a valid TLS certificate covering its hostname.

Why does my subdomain show another website?

The DNS may be correct, but your Apache virtual host or Nginx server block may not be configured correctly. Check the hostname and document root.

Why is my new subdomain not working?

Check the DNS record, authoritative nameservers, server configuration, firewall, HTTPS certificate, and application configuration.

How can I check whether my subdomain points to the correct server?

Run:

dig app.example.com A +short

The returned IP should match the expected server.

Can I point multiple subdomains to different servers?

Yes. Each subdomain can have its own DNS record and destination.


Related Internal Links

For your website’s beginner-friendly web development and security content cluster, add internal links to:

  • How to Troubleshoot DNS Propagation Problems
  • How to Set Up a Staging Subdomain
  • How to Enable HTTPS on a Website
  • How to Add Security Headers to a Website
  • How to Create Scheduled Website Backups
  • How to Secure API Keys in Web Applications
  • How to Prevent SQL Injection
  • How to Prevent Cross-Site Scripting in a Web Application
  • How to Protect Forms Against CSRF
  • How to Secure File Uploads in PHP
  • How to Implement Secure Password Storage
  • How to Restrict Admin Access on a Website

Replace these article titles with your actual internal URLs before publishing. Since your website domain was not provided, no internal URLs have been invented.


Best Practices for Pointing a Subdomain to a Server

The most important principles of How to Point a Subdomain to a Server are:

  1. Know where your authoritative DNS is managed.
  2. Use the correct DNS record type.
  3. Verify the destination IP or hostname.
  4. Configure the destination web server.
  5. Use a separate server configuration when appropriate.
  6. Enable HTTPS.
  7. Install a certificate covering the subdomain.
  8. Redirect HTTP to HTTPS.
  9. Test authoritative DNS.
  10. Test public DNS resolvers.
  11. Check firewall and server ports.
  12. Monitor DNS changes.
  13. Remove unused DNS records.
  14. Protect sensitive subdomains.
  15. Keep server software updated.

Remember that DNS and web-server configuration are separate components. A correct DNS record does not guarantee that the correct application will be served.


Conclusion

How to Point a Subdomain to a Server is a fundamental skill for anyone managing domains, websites, APIs, applications, or cloud infrastructure.

The basic process can be summarized as:

Subdomain
    ↓
DNS Record
    ↓
IP Address / Hostname
    ↓
Destination Server
    ↓
Web Server Configuration
    ↓
HTTPS
    ↓
Application

For example:

app.example.com
        ↓
A Record
        ↓
203.0.113.25
        ↓
Nginx
        ↓
Node.js Application
        ↓
HTTPS

The most important lesson from How to Point a Subdomain to a Server is that DNS is only the first part of the process. You must also configure the destination server to recognize the hostname and serve the correct website or application.

For a basic setup, create an A record when you have a fixed IPv4 address or a CNAME when your service provider gives you a hostname. Then configure your web server, enable HTTPS, test DNS resolution, and verify the application.

If something does not work, do not immediately assume that the problem is DNS propagation. Check the authoritative DNS response first, then investigate the web server, firewall, TLS certificate, and application configuration.

By following the steps in How to Point a Subdomain to a Server, beginners can confidently connect subdomains to VPS servers, cloud applications, staging environments, APIs, WordPress installations, and other web services.

Recommended External Resources

SEO implementation check: The focus keyword How to Point a Subdomain to a Server is included in the SEO title, meta description, URL slug, opening paragraph, multiple H2/H3 subheadings, main article content, examples, checklist, FAQ, and conclusion. The focus keyword and natural keyword combinations appear more than 30 times, targeting a keyword density above 1%. The article exceeds 1,500 words, includes the requested image alt-text specification, external DoFollow resource opportunities, and internal-link opportunities.

How to Set Up a Staging Subdomain 2026

Previous article

How to Configure Nginx for a Website: Complete Beginner’s Guide 2026

Next article

Comments

Leave a reply

Your email address will not be published. Required fields are marked *