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

You can test an Apache name-based virtual host without publishing DNS. Send the virtual host’s configured name in the request while connecting to the server’s IP address. For HTTP, use an explicit Host header or a local hosts-file entry. For HTTPS, preserve the hostname with curl --resolve so both the HTTP hostname and TLS SNI identify the intended virtual host.

How Apache chooses a virtual host

Apache does not select a name-based virtual host from the destination IP alone. It first considers the connection’s local IP address and port, then compares the hostname supplied by the client with the ServerName and ServerAlias values inside the matching <VirtualHost> definitions.

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

That means a public DNS record is not required for a test. The important requirement is that the request carry the same name configured in Apache. You can connect directly to an IP address while still sending a hostname such as app.test.

If no configured name matches the hostname, or if the request does not provide a usable hostname, Apache serves the first virtual host for that IP address and port. This first entry is commonly the default or primary site. Seeing that site at the bare IP therefore does not prove that the target virtual host is broken.

#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: 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.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.

What must match

  • Address and port: The request must reach an address and port covered by the target <VirtualHost>, such as *:80 for HTTP or *:443 for HTTPS.
  • Configured hostname: The request name must equal the target ServerName or one of its ServerAlias values.
  • Protocol details: HTTP needs the hostname in the request’s Host value. HTTPS also needs that hostname during the TLS handshake as SNI.

First inspect the configuration Apache actually parsed

Before testing from another machine, verify that Apache loaded the virtual host you think it loaded. On the Apache server, run:

sudo apachectl -S

On Windows builds, the equivalent command is commonly:

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

The -S switch dumps Apache’s parsed virtual-host configuration. It is more useful than reading files one at a time because it reflects the active include files, address bindings, names, and ordering after Apache has processed the configuration.

What to look for in the output

  • Find the IP address and port you intend to test, for example the entries associated with port 80 or 443.
  • Confirm that the target ServerName or alias appears under the expected address and port.
  • Check the file and line information shown for each virtual host so you can identify an unexpected duplicate or an edit in the wrong configuration file.
  • Identify which virtual host is listed first for the relevant IP:port. That is the site Apache will use when no name matches.

Run the command again after every virtual-host change. If the new host is absent, the problem is on the server side: the file may not be included, the syntax may prevent a reload, or the <VirtualHost> address and port may not cover the connection you are making.

Test an HTTP virtual host with an explicit Host header

For a one-off HTTP test, use curl with the server IP in the URL and the configured hostname in a Host header:

curl -i -H 'Host: app.test' http://203.0.113.10/

Replace app.test with the exact ServerName or a configured ServerAlias. Replace 203.0.113.10 with the address of the Apache server.

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

The connection goes to the IP address, but Apache receives app.test as the requested hostname and can select the corresponding name-based virtual host. No public DNS lookup is involved.

Read the response, not just the page title

The -i option includes the HTTP status line and response headers. Check all of them:

  • Status: A 2xx, 3xx, 4xx, or 5xx result tells you whether the selected site, its redirect rules, or its application generated the response.
  • Location: A redirect can send the browser to another hostname or path, making a correctly selected virtual host appear to be the wrong site on the next request.
  • Server and application headers: These can help distinguish Apache’s response from an upstream application response, if the site uses one.
  • Body: Look for a page or marker that is unique to the target site rather than relying on a generic Apache error page.

For connection and redirect diagnostics, add verbose mode:

curl -v -H 'Host: app.test' http://203.0.113.10/

Verbose output shows the address contacted, the request headers sent, and the response headers received. It is useful when the command reaches a different address than expected or when a redirect changes the hostname.

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

Test an alias separately

If the virtual host has several ServerAlias values, repeat the request with each name. A working ServerName does not establish that every alias is present in the active configuration. For example:

curl -i -H 'Host: www.app.test' http://203.0.113.10/
curl -i -H 'Host: api.app.test' http://203.0.113.10/

Open the site in a browser with a local hosts-file entry

A browser normally sends the hostname from the address bar. To make it send the test name while avoiding public DNS, temporarily map that name to the Apache IP on the client computer. Add a line to the local hosts file:

Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【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.
203.0.113.10 app.test

Use the exact hostname configured in Apache and the server address you want to test. Then browse to:

http://app.test/

The browser resolves app.test to the chosen IP locally, keeps app.test in the request, and Apache can match it to the intended virtual host. This method is useful when you need to exercise ordinary browser behavior, cookies, JavaScript, redirects, or a multi-step login flow rather than a single command-line request.

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

Keep the change temporary

  1. Record the original hosts-file contents before adding the test line.
  2. Add one mapping for the test name and address.
  3. Open the hostname in the browser, not the numeric IP.
  4. After testing, remove or comment out the mapping so later local clients do not continue using the test address.

A hosts-file edit affects name resolution on that client only. It does not create a public DNS record and does not change how other users reach the site.

Use curl –resolve when you want the hostname in the URL

curl --resolve is often the cleanest command-line method because it overrides the address used for a particular hostname without changing the URL. For HTTP:

curl -i --resolve app.test:80:203.0.113.10 http://app.test/

The URL still contains app.test, so curl sends that name as the HTTP hostname, while the connection is forced to 203.0.113.10 on port 80. The override applies to this command rather than changing the machine’s general name resolution.

This is preferable to manually adding a Host header when the application, redirect logic, or diagnostic output needs the original hostname to remain visible in the URL. It also reduces mistakes when you test several names or ports in a script.

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.
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.

Test an HTTPS virtual host without public DNS

HTTPS requires two hostname signals. Apache uses the HTTP hostname after the TLS connection is established, and the TLS handshake uses Server Name Indication (SNI) to identify the name before the encrypted HTTP request is available. Preserve the hostname in both places with:

curl -vk --resolve app.test:443:203.0.113.10 https://app.test/

Here, --resolve makes curl connect to the chosen IP, the URL retains app.test, and curl sends that name as SNI and as the HTTP hostname. Apache can therefore choose the HTTPS virtual host associated with app.test.

Understand the -k option

The example uses -k to continue when the certificate is not trusted by the test machine. Remove -k when the certificate is trusted and covers the test hostname:

curl -v --resolve app.test:443:203.0.113.10 https://app.test/

If verification fails because the certificate does not contain app.test, that is a certificate-coverage problem, not evidence that Apache selected the wrong virtual host. Conversely, using -k bypasses certificate verification; it is suitable for diagnosis, not for proving that a production certificate is correctly trusted.

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

Use the correct port in every part of the test

The port in --resolve must match the port in the URL. A mapping for app.test:80 does not affect an HTTPS request to port 443. Likewise, a virtual host configured only for port 443 will not answer a port-80 test as the same site.

Why browsing to the bare IP shows the default site

When you enter http://203.0.113.10/, the request normally does not contain the hostname of the target virtual host. Apache therefore cannot match ServerName app.test or its aliases. It falls back to the first virtual host defined for that IP and port.

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.

The same fallback can occur when a client sends a hostname that is simply not configured. Treat the first site as Apache’s intentional default for unmatched names. To test another site, supply its configured name explicitly; do not use the bare IP as a selection test.

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

Choose the right method

Method Best use Protocol Scope What it verifies
curl -H 'Host: name' http://IP/ Fast, one-request HTTP check HTTP Only the command Apache’s response to an explicit HTTP hostname
Hosts-file entry Interactive browser testing HTTP or HTTPS All local clients until removed Browser behavior while resolving the name to a chosen IP
curl --resolve name:80:IP http://name/ Scripted HTTP tests with the hostname preserved HTTP Only the command Address override plus hostname-based routing
curl --resolve name:443:IP https://name/ HTTPS and SNI testing HTTPS Only the command Address, SNI name, certificate behavior, and HTTP response
apachectl -S or httpd.exe -S Server-side configuration inspection Not a request The Apache installation Parsed virtual hosts, bindings, names, and ordering

A complete verification workflow

  1. Identify the intended name. Copy the exact ServerName or ServerAlias from the virtual-host definition.
  2. Confirm the binding. Check that the virtual host covers the IP address and port you will contact.
  3. Inspect Apache’s parsed map. Run sudo apachectl -S or httpd.exe -S and verify the name and ordering.
  4. Run an HTTP request. Use curl -i -H 'Host: name' http://IP/ and examine the status, headers, redirects, and body.
  5. Preserve the hostname for browser testing. Add a temporary hosts-file mapping, then open the hostname rather than the IP.
  6. Run an HTTPS request when applicable. Use curl -vk --resolve name:443:IP https://name/ so SNI and the HTTP hostname agree.
  7. Separate routing from certificates. If HTTPS reaches the expected content with verification disabled but fails verification normally, investigate certificate names and trust separately.
  8. Remove temporary client changes. Delete the hosts-file entry when browser testing is complete.

Troubleshoot a result that still looks wrong

The target name is missing from apachectl -S

Apache has not parsed the virtual host you expect. Check that the configuration file is included, that the directive spelling is correct, and that Apache accepted the configuration during reload. Re-run -S after correcting the issue; do not proceed based only on an edited file that is not present in the parsed output.

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.

The name appears, but the address or port is different

A name can be configured correctly and still be unreachable through the address you are testing. Compare the request’s IP and port with the <VirtualHost> binding shown by -S. Test port 80 and 443 independently; an HTTP definition does not automatically cover HTTPS.

HTTP returns the default page

Check the spelling of the value after Host:, including subdomains. It must match a ServerName or ServerAlias. Also ensure that the command is reaching the intended IP. A bare-IP request, a typo, or a name not present in Apache will legitimately fall back to the first virtual host.

HTTPS returns a certificate warning

First confirm that the command preserves the hostname with --resolve. Then determine whether the certificate contains that hostname and is trusted by the client. Temporarily using -k can help you inspect the selected site’s response, but it does not repair a name mismatch or establish certificate validity.

The response redirects to another hostname

Use curl -i or curl -v and inspect the Location header. A redirect may be generated by Apache or by the application running in the selected virtual host. Test the redirected hostname separately with its own Host header, hosts-file mapping, or --resolve entry rather than assuming the first response selected the wrong site.

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

The browser and curl disagree

Compare the names each client sends. A curl command with an explicit Host header can select one site while a browser opened at the numeric IP sends no matching name and receives the default. For HTTPS, also compare SNI: use a hostname in the browser URL or the --resolve HTTPS pattern so the TLS handshake identifies the same virtual host.

Several virtual hosts share one address

That arrangement is precisely where the hostname matters. Test every intended name individually and note the first entry shown by -S. The first entry is the fallback for unknown or absent names, so its content is not a reliable indicator of the other virtual hosts.

Practical command reference

Goal Command
Show parsed virtual hosts on Unix-like systems sudo apachectl -S
Show parsed virtual hosts on common Windows builds httpd.exe -S
Test HTTP with an explicit hostname curl -i -H 'Host: app.test' http://203.0.113.10/
Inspect HTTP connection details curl -v -H 'Host: app.test' http://203.0.113.10/
Override HTTP address while keeping the hostname in the URL curl -i --resolve app.test:80:203.0.113.10 http://app.test/
Test HTTPS, SNI, and the response curl -vk --resolve app.test:443:203.0.113.10 https://app.test/

Key points to retain

  • Apache selects a name-based virtual host from the connection address and port plus the hostname supplied by the client.
  • apachectl -S or httpd.exe -S shows the configuration Apache actually parsed, including fallback ordering.
  • For HTTP, curl -H 'Host: name' http://IP/ tests a virtual host without public DNS.
  • A hosts-file entry gives a browser the hostname it needs while directing that client to a chosen IP.
  • curl --resolve keeps the hostname in the URL while overriding the destination address; on HTTPS it also enables the correct SNI name.
  • A bare IP normally serves the first virtual host for that IP and port, so it is a test of the default site rather than of a named virtual host.

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.