Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

A non-working VPS subdomain is usually failing at one layer: DNS, network access, web-server host matching, the upstream application, or TLS. Check those layers in that order. Use dig to verify the public DNS answer, confirm ports 80 and 443 are open and listening, match the exact hostname in Nginx or Apache, test the application locally, and issue a certificate only after HTTP resolves correctly.

Use this three-minute diagnostic order

Do not start by changing Nginx or Apache when the name does not resolve. A browser cannot reach a web-server configuration until DNS has returned an address and the network allows a connection.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Verify the authoritative DNS record. At the DNS provider that is authoritative for your domain, check that the exact label exists as an A record (IPv4), AAAA record (IPv6), or CNAME (an alias to another hostname). Cloudflare’s documentation notes that your hosting provider must be able to serve the hostname before you create the corresponding “A, AAAA, or CNAME” record: Cloudflare’s subdomain DNS instructions.
  2. Resolve the name from outside the VPS. Query both public and authoritative DNS. If there is no answer or an old address appears, correct the DNS zone or delegation before touching the web server.
  3. Check reachability. Confirm the VPS is listening on TCP 80 and/or 443, and that both the operating-system firewall and your VPS provider’s firewall allow those ports.
  4. Match the hostname in the web server. Add the exact fully qualified domain name (FQDN) to the right Nginx server_name or Apache ServerName block.
  5. Test the application separately. If the web server is a reverse proxy, test the local application port or socket. A proxy error and a DNS error are different failures.
  6. Configure HTTPS last. Once HTTP works, obtain a certificate, then verify the certificate names and the TLS virtual host selected by SNI.

1. Confirm the subdomain’s DNS record

A subdomain is only a label in DNS until it has a record. For a VPS with a fixed public IPv4 address, an A record such as app.example.com A 203.0.113.10 points directly to that address. An AAAA record performs the same job for IPv6. A CNAME, such as app.example.com CNAME edge.example.net, aliases the subdomain to another hostname; the alias’s eventual A or AAAA answer determines where clients connect.

Check the record at the authoritative provider

  • Identify the domain’s authoritative nameservers with dig +short NS example.com.
  • In that provider’s zone, verify the label is exactly the intended one. A record for www.app.example.com does not answer for app.example.com.
  • Check for conflicting records. An obsolete A record, an unexpected AAAA record, or a CNAME left beside another record can send different clients to different destinations.
  • If you recently changed nameservers, update the zone at the provider named by the parent domain, not at an old DNS dashboard. Delegation errors make an apparently correct record invisible to the Internet.

Query public and authoritative answers

Run these commands from a workstation or another network, replacing the hostname:

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application:Upgraded attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Warranty & Support: Our Electric air duster comes with 5 years warranty and 24/7 customer service. During this period, if you have any questions,pls kindly feel free to contact us.
dig +short sub.example.com A
dig +short sub.example.com AAAA
dig +trace sub.example.com

The first two commands show the addresses returned to a normal client. dig +trace follows the delegation chain and helps reveal which nameserver is authoritative. Compare the public resolver’s result with a direct query to an authoritative nameserver. A missing answer, the wrong IP, or an old CNAME means the problem is still in DNS. Local resolver caches can retain an earlier value until its TTL expires, so test from more than one network before assuming the VPS configuration is at fault.

Choose A/AAAA or CNAME deliberately

Record Use it when What must remain correct
A The subdomain should point directly to the VPS’s IPv4 address. The address must remain current if the VPS is replaced or renumbered.
AAAA The VPS accepts IPv6 connections and has a stable IPv6 address. IPv6 routing, firewall rules, and the web server must work; a broken AAAA record can make some clients fail even when IPv4 works.
CNAME You want the subdomain to follow another hostname managed elsewhere. The target hostname must resolve, and DNS providers generally do not allow a CNAME alongside other data at the same label.

2. Make sure the VPS can accept the connection

Correct DNS only gets a client to an IP address. The VPS must have a process listening on the requested port, and every firewall between the client and that process must allow it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check listeners and firewalls

On a Linux VPS, inspect listening sockets with a command such as:

sudo ss -ltnp | grep -E ':(80|443)b'

An Nginx or Apache listener should normally be bound to 0.0.0.0:80/0.0.0.0:443 and, when IPv6 is enabled, [::]:80/[::]:443. A listener bound only to 127.0.0.1 cannot accept Internet traffic directly; that may be intentional for an application behind a reverse proxy, but not for the public web-server socket.

Review the local firewall (for example, the active nftables, iptables, or distribution firewall rules) and the hosting provider’s security-group or network-firewall panel. Allow inbound TCP 80 for HTTP and TCP 443 for HTTPS from the Internet when the site is meant to be public. A timeout commonly indicates a dropped packet by a firewall or an unreachable address; “connection refused” generally means the host was reached but no process accepted the port.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

Test without relying on browser messages

curl -I http://sub.example.com
curl -4 -I http://sub.example.com
curl -6 -I http://sub.example.com

The protocol-specific tests distinguish IPv4 and IPv6 problems. If IPv4 succeeds but IPv6 fails, inspect the AAAA record, IPv6 route, and IPv6 firewall rules. If both fail before an HTTP status appears, return to DNS and network checks.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Configure Nginx for the exact hostname

Nginx chooses a server {} block using the request’s host name and port. Its documentation explains that, when no Host value matches a server_name, Nginx sends the request to the default server for that port: Nginx server-name selection and Nginx’s web-server administration guide.

HTTP virtual host

Create or edit a site configuration with the exact FQDN:

server {
    listen 80;
    listen [::]:80;
    server_name sub.example.com;

    root /var/www/sub.example.com;
    index index.html;

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

For a reverse proxy, replace the static-file location with the local service, for example:

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;
}

Enable the file according to your distribution, test the complete configuration, and reload only after the test passes:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
sudo nginx -t
sudo systemctl reload nginx

Recognize a default-site symptom

If the subdomain displays your main site, Nginx probably handled the request with a default block because the subdomain is absent, misspelled, or placed in the wrong block. Check every HTTPS block as well as HTTP; adding the name to port 80 does not automatically add it to port 443. A request sent by IP address also may select the default site because its Host header is not the subdomain.

4. Configure Apache name-based virtual hosts

Apache uses ServerName as the canonical hostname and ServerAlias for additional names. Define the subdomain in the relevant name-based virtual host, enable the site on systems that use separate site files, and inspect Apache’s parsed result with apachectl -S. The Apache virtual-host documentation covers these directives and the diagnostic command: Apache virtual hosts.

HTTP example

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

    <Directory /var/www/sub.example.com>
        Require all granted
        AllowOverride None
    </Directory>
</VirtualHost>

Add a ServerAlias only for names that should serve the same site. For HTTPS, create a separate <VirtualHost *:443> with the same ServerName, the certificate and key paths, and the required SSL module settings. Then run:

sudo apachectl configtest
sudo apachectl -S
sudo systemctl reload apache2

The apachectl -S output shows which virtual host Apache considers the default and which file owns each name. If the subdomain is mapped to the main site’s block, correct the name or virtual-host ordering rather than changing DNS.

5. Test a reverse-proxy application independently

When Nginx or Apache forwards requests to an application, debug the two hops separately. First test the application on its local bind address and port:

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
curl -i http://127.0.0.1:3000

Use the actual port or Unix socket configured for your service. A successful local response but a failed public request points to proxy routing, headers, permissions, or the public listener. A failed local request means the application process, bind address, socket, environment, or service manager needs attention. Review service logs and confirm the process is running after reboot.

Observed result Most likely layer Next check
DNS error before an HTTP status DNS or delegation Authoritative A/AAAA/CNAME answer and nameservers
Timeout or refused connection Network, firewall, or listener Provider firewall, local firewall, ss, and the destination IP
Main site appears Virtual-host matching Nginx server_name or Apache ServerName and default-host order
502 Bad Gateway Reverse-proxy upstream Local application port/socket, process status, and proxy target
Application response locally but not publicly Proxy or public web-server configuration Correct site block, reload, and access/error logs
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

6. Enable HTTPS only after HTTP works

Certificate issuance cannot repair DNS or a closed port. Certbot’s documentation requires the machine to remain reachable from the Internet on the validation port for each requested name: Certbot usage documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

HTTP-01 validation

HTTP-01 places a challenge under the requested hostname and validates it over TCP port 80. The A/AAAA record must lead to the server handling the challenge, and port 80 must be allowed through every firewall. After those conditions are true, the Nginx or Apache integration can be used:

sudo certbot --nginx -d sub.example.com
sudo certbot --apache -d sub.example.com

Run the command appropriate to the web server, not both. If the challenge fails, test http://sub.example.com/.well-known/acme-challenge/ and inspect the web-server logs.

DNS-01 validation

DNS-01 proves control by requiring a TXT record beneath _acme-challenge.sub.example.com. It does not require port 80 to be reachable, but the TXT record must be published at the authoritative DNS provider and visible to the certificate authority. This method is useful when HTTP is intentionally unavailable or when issuing a wildcard certificate.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

Match certificate names and SNI

The certificate must contain sub.example.com explicitly or cover it with an appropriate wildcard. Nginx explains that TLS is established before the browser sends an HTTP request, so the server may select a default certificate when several HTTPS sites share one IP and the requested name is not selected correctly: Nginx HTTPS configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Ensure the 443 virtual host has all of these items together:

  • server_name sub.example.com; (or the matching Apache ServerName).
  • The certificate file whose names include the subdomain.
  • The corresponding private-key file and correct file permissions.
  • A listener on 443, including IPv6 when an AAAA record is published.
  • The same proxy or document-root configuration intended for the subdomain.

After reloading, inspect the served certificate and negotiated address with curl -Iv https://sub.example.com. A certificate-name warning means the wrong certificate or HTTPS virtual host was selected, not that the HTTP application is necessarily down.

Match the symptom to the failing layer

Browser or command symptom Meaning Fix
DNS_PROBE_FINISHED_NXDOMAIN or “server not found” No usable DNS answer, wrong authoritative nameservers, or an incorrect target Create or correct the record at the authoritative provider and wait for caches to expire
Connection timeout Traffic is being dropped, the address is wrong, or the service is unreachable Check A/AAAA results, provider and OS firewalls, routes, and listeners
Connection refused The destination answered but no process accepted that port Start the web server, bind it to the public interface, or correct the port
Main website on the subdomain The default virtual host handled an unmatched name Correct Nginx server_name or Apache ServerName and reload
502 Bad Gateway The reverse proxy cannot reach or use its upstream Test the local upstream, process status, socket permissions, and proxy address
Certificate name mismatch or unexpected certificate The certificate lacks the subdomain or SNI selected another HTTPS host Issue/install a certificate with the right name and match the 443 host block
Certbot challenge failure DNS points elsewhere, port 80 is blocked for HTTP-01, or the DNS-01 TXT record is missing Correct the validation method’s DNS and network prerequisite, then retry

Nginx versus Apache: which configuration should you inspect?

Area Nginx Apache
Hostname directive server_name inside a server {} block ServerName and optional ServerAlias inside <VirtualHost>
Configuration check nginx -t apachectl configtest
Parsed-host diagnostic Review matching server blocks and the default server for each listen port apachectl -S prints parsed virtual hosts and defaults
Reverse proxy Usually configured with proxy_pass Typically uses the proxy modules and forwarding directives
Common wrong-site symptom Request falls through to the default server block Request matches the first/default virtual host for the address and port

The diagnostic sequence is the same regardless of the server: prove DNS, prove connectivity, prove host matching, then prove the upstream and TLS.

HTTP-01 versus DNS-01 certificate validation

Method Required proof Network prerequisite Typical failure
HTTP-01 A challenge file is reachable at the requested hostname Public DNS must reach the validation server and TCP 80 must be open Port 80 blocked, wrong A/AAAA target, redirect or proxy prevents the challenge path
DNS-01 A TXT value under _acme-challenge Control of the authoritative DNS zone; the web server need not expose port 80 TXT record published at the wrong provider, wrong name, or not yet visible

Final verification checklist

  • The authoritative zone contains the intended A, AAAA, or CNAME record, with no stale conflicting data.
  • dig from an external network returns the VPS address you expect for both IPv4 and any advertised IPv6.
  • The provider firewall and operating-system firewall permit TCP 80 and 443 as required.
  • Nginx or Apache is listening on the required interfaces and ports.
  • The exact subdomain appears in both the HTTP and HTTPS host configuration where applicable.
  • The web-server configuration test passes before reload.
  • A local curl request reaches the upstream application and the proxy target matches its actual bind address and port.
  • The certificate contains the exact hostname (or a valid wildcard), and the 443 host serves the matching key and certificate.
  • Logs are checked after one fresh request, so the timestamped entry corresponds to the failing hostname.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.