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

To serve an app on your domain with Apache, point the domain’s DNS records to the server’s public IP, then create an Apache virtual host that answers for that hostname. A static site uses DocumentRoot; an app listening on a local port uses ProxyPass and ProxyPassReverse. Validate the configuration, reload Apache, test every hostname, and configure HTTPS in a separate port-443 virtual host.

DNS and Apache perform different jobs. DNS tells browsers which server to contact; Apache decides which content or backend should answer after the request reaches that server.

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

What you need before configuring Apache

Have these details ready before editing a virtual-host file:

  • The exact domain name, such as example.com, and any aliases, such as www.example.com.
  • The server’s public IPv4 address for an A record and, if you intentionally provide IPv6 service, its public IPv6 address for an AAAA record.
  • Whether Apache will serve built files directly or forward requests to an application process running on a local port.
  • The filesystem directory for a static site, or the backend bind address and port for a running app.
  • Administrative access sufficient to create files, enable Apache modules or sites, validate configuration, reload the service, and inspect logs.
  • Network rules that permit inbound TCP traffic on ports 80 and 443 when those ports are part of your deployment.

The examples below use example.com. Replace it with your real hostname, but keep the same relationship between DNS, the virtual host, and the application process.

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

DNS must point to the server first

Creating an Apache virtual host does not create DNS records. Add or update the domain’s A and, where appropriate, AAAA records at your DNS provider so that example.com resolves to the server’s public address. If visitors should be able to use the www form, create a record for www.example.com as well, or use a DNS alias that ultimately resolves to the same server.

Wait for the records to become visible through the resolvers your visitors use. Test from outside the server’s network; checking only a local hosts-file entry can hide a public DNS mistake. Confirm that every name you plan to place in ServerName or ServerAlias resolves to the intended machine. An incorrect AAAA record is especially confusing when some clients prefer IPv6 and reach a different host while IPv4 clients reach the correct one.

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.

DNS answers the question “which IP address should receive this request?” Apache answers “which site should respond on that IP and port?” Both answers must be correct for the domain to work.

How Apache chooses a virtual host

Apache first narrows the candidates by destination IP address and port. For HTTP, it then compares the request’s Host header with each candidate’s ServerName and ServerAlias. For HTTPS, the TLS Server Name Indication (SNI) supplies the hostname during the TLS handshake, after which Apache selects the matching TLS virtual host.

If no hostname matches, Apache uses the first name-based virtual host defined for that address and port. That ordering explains many “wrong site” responses: the request reached Apache, but no ServerName or alias matched, so the default (first) vhost answered.

Run apachectl -S to see Apache’s parsed virtual-host map, including the address, port, ordering, and file that defines each vhost. On Windows installations, the equivalent command is commonly httpd.exe -S. This is the first diagnostic to use when Apache serves another site, reports an unexpected certificate, or appears to ignore a new configuration.

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

Serve a static site from Apache

A static deployment consists of files—HTML, CSS, JavaScript, images, and other assets—that Apache reads from a directory. Apache’s core HTTP service handles the request; no application proxy module is needed.

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

1. Create the document root

Create a directory that will contain the built output. For example:

sudo mkdir -p /var/www/example

Copy the finished site into that directory and ensure the Apache worker can traverse the directory and read the files. Use the ownership and permission model supplied by your operating system rather than making the entire tree writable by the web-server account.

2. Define the port-80 virtual host

Create a site configuration containing a ServerName, any aliases, a DocumentRoot, and a matching Directory policy:

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

    <Directory /var/www/example>
        AllowOverride None
        Require all granted
    </Directory>

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

ServerName is the canonical name for this vhost. Add every additional hostname that should serve the same files as a ServerAlias; an alias does not automatically cover unrelated names. AllowOverride None means Apache will not read per-directory .htaccess files for this directory. If your application requires overrides, change that policy deliberately and enable only the directives you need. Require all granted allows normal web requests to read the directory.

The log paths shown use the APACHE_LOG_DIR variable found in many packaged installations. If your distribution does not define that variable, use absolute paths in a directory that Apache can write to.

3. Enable the site using your package’s mechanism

Apache packages differ in how they discover configuration files. Some provide a separate “sites available/sites enabled” workflow; others load files from a single included directory. Place the vhost where your distribution expects it and use that distribution’s enable-site mechanism if one exists. Do not assume that copying a file into an arbitrary directory makes Apache read it.

On systems that provide helper commands, enabling a site may create a link into the active configuration directory. On other systems, you may need to add an Include entry or edit the package’s main configuration. Confirm the file appears in apachectl -S after enabling it.

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.

4. Check syntax and reload Apache

Validate the complete configuration before reloading:

sudo apachectl configtest

Proceed only when the result reports a successful syntax check. Reload Apache through your operating system’s service manager so existing connections can finish while the new configuration is read. The exact service command varies by operating system and package layout; use the command documented for your installation rather than treating one platform’s command as universal.

5. Test both names

Request the bare domain and every alias:

curl -I http://example.com
curl -I http://www.example.com

Check the returned status, headers, and content. A successful response from one name does not prove that the alias is configured: DNS or Apache may still route the other name elsewhere.

Reverse-proxy a running app through Apache

For Node, Python, or another server process, Apache can remain the public entry point while the app listens on a private address such as 127.0.0.1:3000. Apache receives the browser request, forwards it to the backend, and returns the backend response. The app process must already be running and listening on the address and port used in the vhost.

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.

Use the proxy directives together

A basic reverse-proxy vhost is:

<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com
    ProxyPreserveHost On
    ProxyPass        / http://127.0.0.1:3000/
    ProxyPassReverse / http://127.0.0.1:3000/
    ErrorLog ${APACHE_LOG_DIR}/example-error.log
    CustomLog ${APACHE_LOG_DIR}/example-access.log combined
</VirtualHost>

ProxyPass maps requests arriving at Apache to the backend URL. ProxyPassReverse rewrites redirect-related response headers so that clients continue to use the public hostname rather than an internal backend address. ProxyPreserveHost On forwards the original host header, which many frameworks use for routing, URL generation, and allowed-host checks.

The trailing slashes in the example are intentional. Keep the path forms consistent when changing the mapping, and make sure the backend itself is prepared to serve requests at the path Apache forwards.

Enable the required proxy support

Enable the proxy modules required by your Apache package and deployment, then run the configuration test and reload. The module names and package commands vary by platform, so inspect the modules loaded by your installation rather than copying a distribution-specific command blindly. A missing proxy module usually appears as an “invalid command” error during apachectl configtest.

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.

Keep the backend private unless it is intentionally public

Binding the app to 127.0.0.1 keeps direct backend access on the server and makes Apache the controlled public boundary. If the app must be reachable from another machine, bind it to the required private interface and restrict that network path with firewall rules. Do not expose a development server simply because it is convenient for testing.

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

Configure the framework to trust forwarded host and scheme information according to its own security model. This matters when Apache terminates HTTPS but the backend connection remains HTTP: without the framework’s appropriate trusted-proxy setting, an app may generate insecure links, reject the host, or misinterpret the original request scheme.

Configure HTTPS with a separate TLS virtual host

HTTPS requires a vhost on port 443 with TLS enabled and a certificate and private key supplied by your chosen certificate workflow. Apache supports SSL/TLS encryption, URL rewriting, and reverse-proxy configurations, but certificate issuance, file locations, renewal, and key protection depend on your environment and certificate provider.

A TLS vhost follows the same static or proxy pattern as the port-80 vhost, with TLS directives added. A simplified shape is:

<VirtualHost *:443>
    ServerName example.com
    ServerAlias www.example.com
    SSLEngine on
    SSLCertificateFile /etc/ssl/example/fullchain.pem
    SSLCertificateKeyFile /etc/ssl/example/privkey.pem

    ProxyPreserveHost On
    ProxyPass        / http://127.0.0.1:3000/
    ProxyPassReverse / http://127.0.0.1:3000/

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

For a static site, replace the proxy directives with the same DocumentRoot and Directory block used by the HTTP vhost. The certificate must cover every hostname clients will use, including www.example.com if that alias remains active.

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

Test TLS before redirecting HTTP

First confirm that certificate issuance or installation succeeded, the key is readable by Apache, and the port-443 vhost answers the intended names. Test the HTTPS URLs directly. Only after HTTPS works should you change the port-80 vhost to redirect clients to HTTPS. Redirecting too early can turn a certificate or vhost error into a site-wide outage and can make renewal failures harder to diagnose.

When several HTTPS vhosts share an address, Apache uses the TLS SNI hostname to select the certificate and vhost. A missing alias or an unmatched SNI name can therefore produce another site’s certificate even when the HTTP configuration is correct.

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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Static files versus a running application

The right Apache design depends on where content is generated and which process owns the request lifecycle.

Concern Static site Running app behind Apache
Content source Files under DocumentRoot Responses from a backend URL such as http://127.0.0.1:3000/
Apache capability Core HTTP service and directory authorization Proxy modules plus the core HTTP service
Process and restart model Deploy files; Apache serves them without an app process restart Keep the backend process running and manage its restarts separately from Apache
Host and URL handling Apache maps the request directly to a filesystem path ProxyPreserveHost keeps the public host; ProxyPassReverse adjusts backend redirect headers
HTTPS termination Apache can terminate TLS and serve files Apache can terminate TLS and forward to an HTTP backend, provided the app handles trusted forwarded headers correctly

Do not combine a DocumentRoot and a catch-all proxy mapping casually. Decide whether Apache owns the URL space or forwards it, then configure exceptions explicitly if a deployment genuinely needs both.

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

One domain, aliases, and multiple domains

For one site with a second spelling, put the primary name in ServerName and the alternate spelling in ServerAlias. Both names still need DNS records that reach the server, and both names must be covered by the HTTPS certificate when TLS is enabled.

Separate domains that serve different applications should normally have separate virtual hosts. Give each vhost its own ServerName, aliases, document root or proxy target, and log files. Avoid relying on vhost order to separate sites: order determines the fallback response when a hostname is missing or mistyped.

Deployment DNS work Apache naming Ordering and TLS considerations
One domain, no alias Point the single name to the server’s public IP One ServerName Ensure the vhost is loaded on the intended port; certificate covers that name
One domain plus www Point both names to the server, directly or through a DNS alias Primary name in ServerName, alternate in ServerAlias Test both Host values and include both names in the certificate
Multiple independent domains Point every domain and alias to the appropriate server Use separate vhosts with distinct names and content targets Check parsed order with apachectl -S; each TLS name must select the correct certificate

Verify the complete request path

Verification should proceed from the outside in. Each check isolates a different layer:

  1. Use an external DNS resolver to confirm that the domain and aliases return the expected public IPv4 and, if used, IPv6 addresses.
  2. Confirm that firewall and cloud security-group rules allow the ports Apache is expected to accept: 80 for HTTP and 443 for HTTPS.
  3. Run apachectl -S and verify that the expected vhost, aliases, address, port, and configuration file are present.
  4. Run apachectl configtest and resolve every syntax or module error before reloading.
  5. Request each HTTP hostname with curl -I. An unexpected site usually indicates DNS, port selection, hostname coverage, or vhost ordering.
  6. Request each HTTPS hostname separately and inspect the certificate and response. A correct HTTP result does not prove that SNI and the port-443 vhost are correct.
  7. For a proxied app, verify locally that the backend is listening on the configured address and port, then compare the backend’s behavior with Apache’s response.
  8. Read the vhost-specific access and error logs while making a request. The logs show whether Apache received the request and whether the failure occurred before or during proxying.

Troubleshoot the common failure modes

The domain shows no response or times out

  • Check the public DNS answer, not just a local resolver cache.
  • Confirm that the server is listening on the expected port and that host or cloud firewall rules allow it.
  • Check both A and AAAA records. Remove or correct an IPv6 record that points clients to an unintended machine.

Apache serves the wrong site

  • Run apachectl -S to see which vhost is first for the address and port.
  • Compare the requested hostname with the exact ServerName and ServerAlias values.
  • Make sure the edited file is actually enabled and included in Apache’s active configuration.
  • Check that DNS sends the request to the same server whose configuration you inspected.

HTTP works but HTTPS shows another certificate

  • Verify that a port-443 vhost exists for the requested name and that SNI matching includes the alias.
  • Check that the certificate covers the exact hostname, not merely a related name.
  • Inspect apachectl -S for competing TLS vhosts and their load order.

The proxy returns a gateway error

  • Confirm that the backend process is running and listening on the exact address and port in ProxyPass.
  • Check whether a local firewall, process policy, or bind address prevents Apache from reaching the backend.
  • Read both Apache’s error log and the application log; the former identifies proxy-connection failures while the latter may explain an application-level rejection.
  • Verify that required proxy modules are enabled and that ProxyPassReverse and path slashes match the intended URL mapping.

The app redirects to an internal address or generates HTTP links

Keep ProxyPreserveHost On, configure the application’s trusted proxy or forwarded-header settings according to its framework, and ensure the app knows whether the original client connection was HTTPS. Apache can terminate TLS while forwarding plain HTTP locally, so the backend must receive trustworthy information about the public scheme.

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

Apache refuses to reload after an edit

Run apachectl configtest before attempting another reload. Typical causes include a misspelled directive, a module that is not loaded, an invalid certificate path, or an unclosed XML-like Apache block. Fix the reported file and line first; do not hide the error by repeatedly restarting the service.

Maintain the deployment after it works

Keep separate access and error logs for each important vhost so that traffic and failures can be associated with the correct domain. Review log growth and retention using the facilities provided by your operating system. When deploying a new build, update the static files or restart the backend process as appropriate, then make a request through the public hostname rather than testing only the local process.

Document which DNS names belong to each vhost, which process owns each backend port, where certificates and keys are stored, and how the service is reloaded on your platform. Recheck certificate renewal before expiration and test both the bare domain and every alias after changes. If you add a domain later, update DNS, Apache naming, and certificate coverage as one change; leaving one layer out produces an apparently random failure.

Configuration checklist

  • DNS A/AAAA records resolve every public hostname to the intended server.
  • The vhost has the correct ServerName and every required ServerAlias.
  • Static content has a readable DocumentRoot, or the proxy target is running on the expected private address and port.
  • Required proxy and TLS modules are available for the directives used.
  • apachectl configtest succeeds before every reload.
  • apachectl -S shows the intended vhosts and no accidental default is taking precedence.
  • Ports 80 and 443 are allowed by host and cloud firewalls where needed.
  • HTTP and HTTPS requests succeed for the bare domain and each alias.
  • The application trusts forwarded host and scheme headers only according to its documented security settings.
  • Access and error logs are available for each vhost and are checked when behavior differs from expectations.

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.