Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Creating blog.example.com in Apache requires two separate configurations: DNS must direct the hostname to the server, and Apache must select a name-based virtual host whose DocumentRoot contains the subdomain’s files. A virtual-host file cannot create a public DNS record by itself. Once both layers are configured, verify Apache’s parsed map with apachectl -S on Unix-like systems or httpd.exe -S on Windows, then test the hostname.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
What a subdomain does—and what Apache does not do
A subdomain is a hostname under an existing domain, such as blog.example.com under example.com. The browser first resolves that hostname through DNS. It then opens a connection to the resulting server address and sends the hostname in the HTTP request. Apache examines that hostname and chooses the matching <VirtualHost> block.
As an Amazon Associate I earn from qualifying purchases.
| Layer | Responsibility | What to verify |
|---|---|---|
| DNS | Maps the subdomain to the server address. | A lookup such as dig blog.example.com returns the intended address. |
| Apache | Matches the request hostname to ServerName or ServerAlias and serves a directory. |
apachectl -S or httpd.exe -S shows the expected virtual host and configuration file. |
| Filesystem | Stores the files Apache returns for that host. | The configured document root exists, contains the expected index file, and is readable by Apache. |
These jobs are independent. Adding a virtual host does not publish a DNS record, and publishing a DNS record does not tell Apache which directory to serve. A missing DNS record prevents the request from reaching the intended server; a missing or mismatched virtual host can send a valid request to another site on that server.
Decide the layout before changing Apache
You need control of the domain’s DNS, access to the Apache installation, and a directory dedicated to the new hostname. Confirm which address and port Apache listens on, because the address and port in the virtual-host declaration must match the listener that receives the request.
#1 Best Overall
Most subdomains use name-based virtual hosting. Several hostnames share one IP address, and Apache distinguishes them by the hostname supplied in each request. IP-based hosting is a different design in which each virtual host needs its own IP-and-port combination.
| Design | How Apache distinguishes sites | When it fits |
|---|---|---|
| Name-based hosting | One address and port can serve several hostnames; Apache compares the request name with each block’s ServerName and ServerAlias. |
The usual choice when multiple subdomains share a server address. |
| IP-based hosting | Each virtual host is associated with a distinct IP-and-port combination. | Only when the environment requires separate addresses or ports. |
Step 1: Create the DNS record
At the DNS provider, create an A record for the hostname, for example:
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitches- Name:
blog(some providers display this as the complete nameblog.example.com) - Type: A
- Value: the server’s public IP address
Use the DNS record type appropriate to your environment if the server is addressed differently. The essential result is that blog.example.com resolves to the address where Apache is listening. DNS changes may not be visible immediately because resolvers retain earlier answers for their configured cache period, so check resolution rather than assuming the record is active.
From a machine that should reach the site, run:
dig blog.example.com
Use an equivalent DNS lookup utility when dig is unavailable. The answer should contain the intended server address. If it does not, fix DNS before changing Apache; no virtual-host directive can compensate for a hostname that resolves elsewhere.
For a test from one computer only, you can add the hostname to that computer’s hosts file and point it at the server address. This changes name resolution on that machine; it does not publish the subdomain to the Internet, so every other client still needs the real DNS record.
Step 2: Create a document directory and test file
Choose a directory used only by the subdomain, such as /var/www/blog, and place an index.html file in it. A simple test page can contain the hostname and a short message so that you can distinguish it from the main site.
The exact path and permission commands depend on the operating system and Apache package. Check that every directory component can be traversed by the Apache worker and that the index file is readable by it. A correct virtual host pointing at a nonexistent or unreadable directory cannot serve the intended page.
Step 3: Add a name-based virtual host
Create a virtual-host file using the configuration mechanism provided by your Apache installation. This minimal HTTP example gives the subdomain its own document root and separate logs:
<VirtualHost *:80>
ServerName blog.example.com
DocumentRoot /var/www/blog
ErrorLog ${APACHE_LOG_DIR}/blog-error.log
CustomLog ${APACHE_LOG_DIR}/blog-access.log combined
</VirtualHost>
How each directive controls the result
<VirtualHost *:80>limits this block to requests received on port 80 for any local address represented by the asterisk. Use the address and port that match your listener.ServerName blog.example.comis the primary hostname Apache compares with the request hostname. Set it explicitly on every virtual host.DocumentRoot /var/www/blogidentifies the directory from which Apache serves the subdomain’s files.ErrorLogrecords errors for this host, whileCustomLogrecords requests using the shown combined format. TheAPACHE_LOG_DIRvariable is commonly supplied by packaged installations; follow your package’s logging conventions if that variable is not defined.
The block needs, at minimum, a ServerName and a DocumentRoot. Add a ServerAlias only when another hostname is intentionally supposed to serve the same content:
<VirtualHost *:80>
ServerName blog.example.com
ServerAlias www.blog.example.com
DocumentRoot /var/www/blog
</VirtualHost>
Do not add aliases merely to make an unplanned name work. Every alias a user enters must also resolve through DNS (or through a deliberate hosts-file entry during local testing). Apache can match wildcard aliases, but a wildcard in the configuration does not create wildcard DNS records.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Rank #3
- Used Book in Good Condition
Step 4: Put the file where this Apache package loads it
Apache installations do not all use the same directory layout. Debian-family packages commonly separate files into sites-available and sites-enabled; other packages include virtual-host files from a different directory or from the main configuration. Identify the include path used by the installed package and place the file where that package reads it.
There is no universal enable command that is safe to copy across operating systems. Use the package’s normal mechanism to include or enable the file, then verify that Apache actually reads it. A file sitting in an unused directory has no effect, even if its syntax is perfect.
Step 5: Inspect Apache’s parsed virtual-host map
Before reloading, ask Apache to show how it interpreted the configuration:
apachectl -S
On Windows, use:
httpd.exe -S
The output is more useful than looking at filenames alone. Confirm that it lists blog.example.com, the expected address and port, and the file containing the block. It also reveals which virtual host is first for each address-and-port pair. If your new host is absent, the file was not included, the name is misspelled, or Apache rejected the configuration before building its map.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Step 6: Validate and reload Apache
Run the configuration-test command supplied by your operating system’s Apache package. Fix every reported syntax or path error before applying the change. Then use that package’s service-management procedure to reload Apache so the running process adopts the validated configuration.
Rank #4
The exact test and reload commands vary by distribution, installation method, and Windows service setup. Do not substitute a command documented for a Debian package into an unrelated installation. If the reload fails, keep the previous working configuration in place, read the reported error, correct the indicated file, test again, and reload only after the test succeeds.
Step 7: Request the hostname and verify the result
Open http://blog.example.com/ in a browser or make an equivalent HTTP request. The response should be the index.html from /var/www/blog, not the page from another virtual host. Check the subdomain’s access log for the request and its error log for filesystem or configuration problems.
If the wrong site appears, do not immediately move files around. Work through the routing chain in order:
- Resolve
blog.example.comand confirm that it returns the intended server address. - Check the spelling of the browser’s hostname against
ServerNameand everyServerAlias. - Confirm that the request’s address and port match the
<VirtualHost>declaration. - Run
apachectl -Sorhttpd.exe -Sand verify that the file is loaded. - Confirm that the document root exists, contains the expected file, and is readable by Apache.
- Review virtual-host order if no configured name matches.
Why Apache may show the wrong website
For a given address and port, Apache compares the request hostname with the ServerName and ServerAlias values in the matching virtual-host set. When no name matches, Apache uses the first virtual host listed for that address and port. That first block is therefore the default for unknown, misspelled, or missing hostnames.
Make the default intentional by placing the desired fallback first, and define ServerName on every virtual host. This does not make an unknown hostname valid; it simply determines which site receives requests that do not match a configured name.
Best Value
A client that omits the Host header, sends an unknown name, or reaches the wrong address can consequently receive the primary site. Testing by IP address alone is not a valid test of a name-based subdomain, because the IP address does not identify which hostname you intend to serve.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Aliases, wildcards, and shared content
Use aliases deliberately
ServerAlias is appropriate when two or more names should return the same files, such as a canonical name and an alternate spelling. It is not a substitute for a second document root. If two hostnames need different content, give them separate virtual-host blocks and separate directories.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Wildcards still require DNS
Apache supports wildcard names in aliases, which can reduce repetitive configuration when many names intentionally share content. DNS remains a separate requirement: each requested name must resolve to the server, whether through individual records or a DNS wildcard supported by your provider. An Apache wildcard cannot answer a name that never reaches the server.
Troubleshooting by symptom
| Symptom | Likely layer | Checks and corrective action |
|---|---|---|
| The hostname does not resolve. | DNS | Run dig blog.example.com. Correct the A record or the environment-appropriate DNS record and allow for resolver caching. |
| The hostname resolves to another server. | DNS or hosting topology | Compare the lookup result with the address where Apache listens. Correct the record or the intended server assignment before editing Apache. |
| The main site appears instead of the subdomain. | Apache name matching | Check the exact hostname, ServerName, aliases, address and port, loaded-file status, and the order shown by apachectl -S or httpd.exe -S. |
| The new host is absent from the parsed map. | Apache loading | Place the file in the package’s included directory or enable it through that package’s normal mechanism, then rerun the parsed-configuration command. |
| The expected page is not in the response. | Filesystem or document root | Confirm that DocumentRoot points to the intended directory, that index.html exists there, and that Apache can read the path. |
| Apache refuses to reload. | Configuration syntax or paths | Run the installation’s configuration-test command, correct each reported error, and retry the reload only after validation passes. |
| A local test works but another network does not. | Local name override or DNS | Check whether the successful machine uses a hosts-file entry. That entry affects only that machine and does not publish the subdomain. |
| An unknown hostname receives a valid site. | Default virtual host | Expected behavior when no name matches: Apache serves the first vhost for the address and port. Make that fallback intentional and correct the requested hostname or DNS. |
A repeatable verification checklist
- The DNS record for the subdomain points to the address serving Apache.
- A DNS lookup from the intended client returns that address.
- The dedicated document directory exists and contains the expected index file.
- Apache can traverse the directory and read its files.
- The virtual-host block has the correct address and port.
ServerNameexactly matches the hostname in the request.- Any
ServerAliasvalues are intentional and have corresponding DNS resolution. - The file is included by the installed Apache package.
apachectl -Sorhttpd.exe -Sshows the expected name, file, address and port.- The package’s configuration test succeeds.
- Apache has been reloaded using the package’s normal service procedure.
- The browser request returns the subdomain’s test file and appears in the expected logs.
Scope of this example
The configuration shown is an HTTP virtual host on port 80. It establishes DNS routing, name-based selection, a document root, and logging. HTTPS requires its own listener and certificate-related configuration, which should be designed and validated separately rather than assumed to be enabled by this HTTP block.
Once DNS resolves the name, Apache loads the virtual-host file, and the parsed map shows the intended match, the subdomain is functioning as a distinct Apache site. Future changes should preserve that separation: change DNS when the destination address changes, change the virtual host when hostname routing or content location changes, and use the logs and parsed configuration to identify which layer produced an unexpected result.
Quick Recap
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.
Recommended Free Tools




