What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

If sub.example.com displays the website for example.com, DNS is usually only half of the configuration. The subdomain may correctly resolve to the server’s IP address, but Nginx or Apache is not matching the request’s hostname to a dedicated virtual host. An unmatched request is then handled by the default or first-listed site.

Fix it by checking DNS, creating an exact hostname match for the subdomain on the required port, configuring HTTPS separately when applicable, checking for application-level redirects, and testing with an explicit hostname and SNI request.

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

What “pointing to the main domain” actually means

A DNS record does not select a website directory or application. It only tells a browser where to send the request. It is perfectly normal for the root domain and several subdomains to resolve to the same IPv4 address, IPv6 address, or load balancer.

After DNS resolution, the web server chooses a virtual host using the hostname supplied by the client:

#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.
  1. For ordinary HTTP, the browser sends a Host value such as sub.example.com.
  2. For HTTPS, the TLS handshake uses the Server Name Indication (SNI) hostname before the encrypted HTTP request is processed.
  3. Nginx or Apache compares that name with its configured virtual hosts and serves a document root or proxy target.

If no matching host exists, Nginx routes the request to the default server for that port. Apache commonly uses the first listed virtual host for the matching address and port. That fallback is why a subdomain can show the main site even though its DNS record is correct.

Start with a short diagnosis

What you observe Most likely location of the problem What to inspect
Both names resolve to the intended IP, but HTTP shows the main site Missing or incorrect port-80 virtual host Nginx server_name or Apache ServerName, aliases, and default-vhost order
HTTP is correct, but HTTPS shows the main site Missing 443 host, wrong certificate vhost, or SNI mismatch The TLS-enabled server/vhost, certificate names, and 443 content or proxy target
The correct page appears briefly, then the address changes to the root domain Application or reverse-proxy redirect The HTTP Location header, canonical URL setting, forwarded headers, and application logs
A generic welcome page appears An unintended default site is catching the request Default-server settings and the order of enabled virtual hosts
Only one path or asset goes to the main site Application routing or proxy configuration Rewrite rules, upstream host handling, and per-location proxy rules

1. Verify DNS before changing the web server

Check the subdomain’s A, AAAA, or CNAME record and confirm that it ultimately reaches the server, load balancer, or reverse proxy intended to host the subdomain. Test from a resolver that is not affected by your local cache, and check both IPv4 and IPv6 if both records exist.

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

A record that resolves to the same address as the main domain is not an error. The important questions are whether the address is correct and whether an unexpected AAAA record sends some clients to a different machine.

  • Inspect the A record with dig sub.example.com A or an equivalent DNS lookup tool.
  • Inspect IPv6 with dig sub.example.com AAAA. Remove or correct an AAAA record if the IPv6 endpoint is not configured with the same virtual host.
  • Follow a CNAME to its final address and verify that the target is the service you intend to use.
  • Check the authoritative DNS zone if public resolvers return different answers during a recent change; TTL caching can make old data persist temporarily.

Apache’s virtual-host guidance describes the relationship directly: map each hostname to the correct IP in DNS, then configure Apache to recognize the different hostnames. DNS alone cannot choose between two websites on one listener.

2. Fix Nginx hostname matching

Create a dedicated HTTP server block

Give the subdomain its own server block. Use the exact fully qualified name and point it to the correct static directory or upstream application.

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

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

For a reverse-proxied application, replace the static-file directives with the intended upstream, for example:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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
server {
    listen 80;
    server_name sub.example.com;

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

The upstream port and header policy must match your application. Do not copy the main domain’s proxy target merely because the two names share an IP address.

Keep the main site’s name list exclusive

Inspect every enabled Nginx configuration. The main site should list only names that are supposed to serve the main site. Remove an accidental sub.example.com from its server_name line and check for broad wildcards such as *.example.com that intentionally or unintentionally catch the subdomain.

Nginx evaluates exact, wildcard, and regular-expression names according to its server-name matching rules. An exact name is the clearest choice for a single subdomain. Also check whether another block is marked default_server on port 80; that block will handle names for which no better match exists.

Enable the configuration and check for duplicate definitions

On systems that use a sites-available/sites-enabled layout, place the file in the distribution’s expected directory and enable it with the platform’s normal symlink or management command. Make sure the file is actually included by the top-level Nginx configuration. A perfectly written file has no effect if it is outside the active include path.

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

Search the loaded configuration for the hostname and confirm that it appears in the intended block, not in two competing blocks. Duplicate exact names make the result dependent on configuration order and can be especially confusing after a migration.

Add the HTTPS server block separately

HTTP and HTTPS are separate listeners. Create a matching TLS block on port 443 rather than assuming the port-80 block will be reused:

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.
server {
    listen 443 ssl;
    server_name sub.example.com;

    ssl_certificate     /etc/letsencrypt/live/sub.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/sub.example.com/privkey.pem;

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

Use the certificate and key paths supplied by your certificate-management system. If TLS is terminated by a load balancer or hosting platform, configure the hostname and certificate there, then ensure the request is forwarded to the correct backend block.

Validate and reload Nginx

  1. Run nginx -t. Do not reload if the syntax test reports an error.
  2. Fix missing semicolons, invalid paths, duplicate listen options, or certificate-file errors reported by the test.
  3. Reload Nginx with the service manager used by your operating system, such as systemctl reload nginx.
  4. Repeat the test from the client side using an explicit hostname and, when necessary, an explicit destination IP.

3. Fix Apache virtual-host matching

Create an explicit port-80 virtual host

Define a separate virtual host with an exact ServerName. Keep ServerAlias limited to names that should serve the same application.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<VirtualHost *:80>
    ServerName sub.example.com
    DocumentRoot /var/www/sub.example.com

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

For a proxied application, use the proxy directives required by the application and ensure the upstream target is the subdomain’s service. A static DocumentRoot does not automatically apply to a proxied site, and a proxy rule inherited from the main site can send traffic to the wrong application.

Audit ServerAlias and vhost order

Remove the subdomain from the main site’s ServerAlias list unless both names are deliberately one site. Check wildcard aliases such as *.example.com for the same reason.

Apache selects a name-based virtual host using the address and port, then the requested hostname. If no configured name matches, the first listed virtual host for that address and port is used. Therefore, an unmatched subdomain can display the main site even when Apache is running normally.

Configure a parallel 443 virtual host

HTTPS needs its own virtual host and certificate configuration:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.
<VirtualHost *:443>
    ServerName sub.example.com
    DocumentRoot /var/www/sub.example.com

    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/sub.example.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/sub.example.com/privkey.pem

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

The exact TLS directives and certificate paths vary by operating system and Apache modules. The hostname, content root or proxy target, and certificate coverage must all belong to the subdomain.

Enable, inspect, and reload Apache

  1. On distributions that provide site-available/site-enabled tooling, enable the new site using that distribution’s standard command.
  2. Run apachectl -S to display the parsed addresses, ports, virtual-host order, and duplicate names. On Windows, use httpd.exe -S.
  3. Check the output for the expected ServerName on both 80 and 443, and look for a different file claiming the same hostname.
  4. Run Apache’s syntax check, commonly apachectl configtest, and correct any error before reloading.
  5. Reload Apache with the service manager used by your system.

4. Treat HTTPS as a separate selection problem

With HTTPS, the server may choose a virtual server during the TLS handshake from the SNI name before it can read the encrypted HTTP Host header. A correct port-80 configuration therefore does not prove that port 443 is correct.

Check all of the following for the subdomain:

  • The certificate’s subject or Subject Alternative Name includes sub.example.com.
  • The 443 Nginx server_name or Apache ServerName is an exact match or an intentional wildcard.
  • The TLS block serves the subdomain’s document root or proxy target, not the main site’s.
  • The certificate presented for the tested IP is the expected one. A certificate for the root domain often indicates that the default TLS virtual host answered.
  • If a CDN, load balancer, or reverse proxy terminates TLS, its hostname-to-backend mapping is correct; changing only the origin server may not change the result seen by browsers.

5. Distinguish a wrong virtual host from an application redirect

There are two different symptoms: the server can return the main site immediately, or it can return the subdomain’s application and then redirect the browser to the root domain.

Inspect the response without following redirects:

curl -I --resolve sub.example.com:80:SERVER_IP http://sub.example.com/
curl -I --resolve sub.example.com:443:SERVER_IP https://sub.example.com/

Replace SERVER_IP with the intended IPv4 address. Use an IPv6 test if the site is published through AAAA. The --resolve option makes the request use the chosen address while retaining the hostname for the HTTP Host header and, for HTTPS, SNI.

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

Interpret the result as follows:

  • A response containing the main site’s headers or content with no redirect usually indicates virtual-host selection, a wrong document root, or an upstream mapping error.
  • A 301 or 302 with a Location: https://example.com/... header proves that some layer is issuing a redirect. Inspect application canonical-URL settings, framework base-URL variables, rewrite rules, and reverse-proxy headers.
  • A redirect only when the request arrives through a proxy can indicate missing or incorrect X-Forwarded-Host or X-Forwarded-Proto handling.
  • A redirect that occurs only on HTTPS can come from the TLS vhost, an HTTPS-specific rewrite, or an application that believes its public hostname is the root domain.

Review access and error logs at the same time as the curl request. The selected virtual host’s log file should record the request. If it appears in the main site’s log, the request is still being caught by the wrong configuration.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

6. Test with the same hostname users send

Testing an IP address in a browser is misleading: the browser then sends the IP as the hostname, so the server is expected to choose a default site. Always test with the subdomain name and force the destination address when you need to bypass DNS.

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.
  1. Test port 80 with curl -I --resolve sub.example.com:80:SERVER_IP http://sub.example.com/.
  2. Test port 443 with curl -I --resolve sub.example.com:443:SERVER_IP https://sub.example.com/.
  3. Record the status code, every Location header, the certificate subject/SAN for HTTPS, and identifying response headers.
  4. Compare those results with equivalent requests for example.com. The two names may share an address but should resolve to their intended roots or upstream services.
  5. After any DNS change, test from more than one network because recursive resolvers can retain cached answers until the record’s TTL expires.

Nginx and Apache: the relevant differences

Concern Nginx Apache
Hostname directive server_name inside a server block ServerName and deliberate ServerAlias inside VirtualHost
Unmatched-name behavior Routes to the default server for the port Uses the first listed matching-address virtual host for the port
Static content root and optional index DocumentRoot
Reverse proxy Typically configured with proxy_pass and explicit forwarded headers Configured with the proxy modules and rules appropriate to the upstream
HTTPS host Separate listen 443 ssl server block, certificate, and key Separate <VirtualHost *:443> with TLS directives and certificate
Configuration inspection nginx -t validates syntax; inspect the loaded include tree and active files apachectl -S or Windows httpd.exe -S shows parsed vhosts and order

Common mistakes that keep the main site appearing

The hostname is misspelled

sub.example.com, sub.example.net, and www.sub.example.com are different names. Put every deliberately supported name in the correct alias list and do not assume one spelling matches another.

The subdomain exists only on port 80

Browsers, HSTS policies, and application redirects can move users to HTTPS. A working HTTP block cannot answer for a missing or incorrect 443 block.

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

A wildcard catches the request first

Wildcards are useful for multi-tenant designs, but they can hide a missing exact host. Decide whether the subdomain belongs to the wildcard application or needs an exact exception, then configure the matching rules accordingly.

The file was created but never loaded

Distribution layouts, container images, and control panels use different include paths. Confirm the active configuration, not just the file on disk, contains the new block.

IPv6 reaches a different server

Some clients prefer AAAA over A. If IPv6 points to an old host whose default vhost is the main site, IPv4 tests may look correct while many users still see the wrong page.

The upstream application canonicalizes the root domain

When the web server logs show the subdomain block but the response contains a root-domain Location, update the application’s public URL and trusted-proxy settings. The web-server host match is then working; the redirect source is higher in the stack.

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

Final verification checklist

  • The subdomain’s A, AAAA, or CNAME records reach the intended endpoint.
  • The main-domain configuration does not accidentally include the subdomain as an alias.
  • Nginx has an exact server_name, or Apache has an exact ServerName, for every required port.
  • The subdomain points to the correct static directory or upstream service.
  • HTTPS has its own matching host configuration and a certificate covering the subdomain.
  • Configuration syntax checks pass before reload.
  • Apache’s parsed-vhost output or the active Nginx configuration confirms the expected block is loaded.
  • Explicit curl --resolve tests show the intended status, headers, certificate, and absence of an unwanted root-domain redirect.
  • Logs identify the subdomain’s virtual host and do not show the request being handled by the main site.

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.