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

There is no single guaranteed location for Apache’s configuration. The main file is conventionally named httpd.conf, but its path is chosen when Apache is built and can be replaced at startup with the -f option. Package layouts also split configuration into included files, so the virtual host you need may not be inside the main file at all. Source installations commonly use /usr/local/apache2/conf/httpd.conf; Debian and Ubuntu packages normally use /etc/apache2/; Fedora, CentOS and RHEL packages normally use /etc/httpd/conf/httpd.conf plus /etc/httpd/conf.d/. The reliable method is to identify the configuration Apache actually parsed, create the vhost in a file that is included, and verify the result with apachectl -S (or httpd.exe -S on Windows).

Find the configuration Apache is really using

The name httpd.conf describes a convention, not a universal filesystem rule. Apache’s default main-file location is set at compile time, normally relative to its ServerRoot. A service, wrapper script or administrator can also start the server with -f and point it at a different file. Finally, the main file can load other files with Include. For those reasons, finding a file named httpd.conf is only the first step; you must establish that the running or newly started server reads it.

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

What to check first

  • Look for the installation’s conf directory and the conventional httpd.conf file.
  • Inspect the service definition, startup script or scheduled command for a custom -f argument.
  • Read the main file for Include directives. A site-specific file may be the correct editing target.
  • After making a change, run the virtual-host dump command so Apache shows the files, addresses and names it parsed.

Do not edit a similarly named backup, example or distribution template and assume the change is live. If the active process is started with another file, or if your file is outside every active Include, Apache will never see the edit.

Common httpd.conf locations by installation

Installation Where to look What that means for a virtual host
Built from Apache source /usr/local/apache2/conf/httpd.conf is common Confirm the configured ServerRoot and check whether startup supplies -f. The source prefix can be changed at build time.
Debian or Ubuntu package /etc/apache2/; per-site files normally live in /etc/apache2/sites-available/ and enabled links or entries appear in /etc/apache2/sites-enabled/ A vhost usually belongs in its own site file, then must be enabled through the distribution’s site mechanism.
Fedora, CentOS or RHEL package /etc/httpd/conf/httpd.conf, with additional package-managed files commonly in /etc/httpd/conf.d/ A site-specific .conf file in conf.d is often cleaner than changing the global file, provided that directory is included.
Windows or a custom package Use the installation’s conf directory and the service or command-line startup settings The active path depends on how the package or service was built. Confirm the file and any -f option instead of relying on a remembered default.

Distribution maintainers can change their arrangement between releases. A package may retain the conventional main file while moving most site definitions into fragments. Treat the table as a starting point, not proof that a particular server uses that exact path.

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

Understand how Apache assembles its configuration

Apache starts with one main configuration file and processes directives in order. An Include directive adds another file or set of files to that configuration. This is why a Debian or Ubuntu site file, or a RHEL-family file in conf.d, can control a website without placing its <VirtualHost> block directly in httpd.conf.

Choose an included, site-specific file

  1. Identify the main file and the active Include paths.
  2. Create one clearly named file for the site, such as example.conf, in a directory Apache actually includes.
  3. On Debian or Ubuntu, put the file in /etc/apache2/sites-available/ and use the package’s site-enabling mechanism so it is represented in sites-enabled.
  4. On Fedora, CentOS or RHEL, place a site-specific .conf under /etc/httpd/conf.d/ when that directory is enabled, or add an explicit Include from the main file.
  5. For a source or custom installation, add an Include for the chosen file if the default configuration does not already load it.

Keeping one vhost per file makes it easier to disable a site, review a change and locate a syntax error. It also avoids turning the global file into an unstructured collection of unrelated applications.

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.

Create a basic name-based virtual host

A name-based virtual host lets several websites share an address and port. Apache uses the request’s address and port together with the HTTP Host header to choose a block. Start with a minimal HTTP definition and add only the features the site requires.

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
<VirtualHost *:80>
    ServerName www.example.test
    ServerAlias example.test
    DocumentRoot "/var/www/example"
    ErrorLog "/var/log/apache2/example-error.log"
    CustomLog "/var/log/apache2/example-access.log" combined

    <Directory "/var/www/example">
        Require all granted
    </Directory>
</VirtualHost>

What each directive does

  • <VirtualHost *:80> limits this definition to port 80 on all local addresses represented by the wildcard. Use the address and port that the server actually listens on.
  • ServerName is the primary hostname. Clients should send this name in the Host header.
  • ServerAlias adds additional names, such as the bare domain. Add only names that should serve the same content.
  • DocumentRoot identifies the directory from which Apache serves files for this host.
  • ErrorLog and CustomLog separate this site’s diagnostics and requests from other virtual hosts. The combined format is a standard access-log format when it is available in the installation.
  • The <Directory> section applies filesystem access rules to the document root. Require all granted permits requests to that directory under Apache’s authorization model; stricter applications may need narrower rules.

Use forward slashes in configuration paths, including on Windows, as required by Apache’s configuration-section rules. Quote a path when it contains spaces. Make sure the document-root directory exists and that the account running Apache can traverse its parent directories and read the site files.

Enable the site on each platform

Debian and Ubuntu

Create the vhost file under /etc/apache2/sites-available/. Enable it with the distribution’s site-enabling mechanism so the corresponding entry appears under sites-enabled; on many installations the helper is named a2ensite, but the exact helper and service command depend on the package release and init system. If you edit a file in sites-available without enabling it, the change may have no effect because Apache reads the enabled set.

After enabling, perform the syntax check used by that installation and reload or restart the service through its normal administration method. A reload is preferable when supported because it applies a valid configuration without unnecessarily interrupting existing connections.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Fedora, CentOS and RHEL

Place the site definition in /etc/httpd/conf.d/ with a .conf suffix when the package’s main file includes that directory. If it does not, add an explicit Include in the active configuration. Run the platform’s normal syntax check, then reload or restart the HTTP service using the local service manager. Keep the vhost’s logs separate so a failed request can be distinguished from another site on the same daemon.

Source-built Apache

Start with the commonly used /usr/local/apache2/conf/httpd.conf, then verify the configured ServerRoot and any startup override. Add the vhost directly to the main file or, preferably, create a separate file and include it. The command name and service integration are determined by how Apache was installed, so use that installation’s control script and preserve a copy of the last known-good configuration.

Windows

Find the installation’s conf directory and inspect the Windows service definition or launch command for the active file and any -f option. Create the vhost with Windows filesystem paths written using forward slashes. Use httpd.exe -S from the installation’s executable directory to inspect the parsed result, then use the service’s normal configuration-test and restart procedure.

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.

How Apache chooses among virtual hosts

For a request, Apache first considers the local address and port selected by the connection. Within that address-and-port group, it compares the HTTP Host header with each block’s ServerName and ServerAlias. A matching name selects the corresponding vhost.

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

If no name matches, Apache uses the first applicable name-based vhost for that address and port as the primary or default host. File ordering therefore matters, especially when a client sends an unexpected hostname, omits the header, or reaches the server by its IP address. Do not assign the same name to multiple blocks unless you intentionally understand which one will win; duplicate names commonly produce surprising content or logs.

A TLS site follows the same address-and-port grouping concept, but it also needs a TLS-enabled listener and certificate directives appropriate to the installation. Add HTTPS configuration only after the HTTP vhost is selecting correctly, and keep certificate, key and protocol settings in the host that owns that name.

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

Test a hostname before DNS is public

You can test name-based selection without waiting for DNS by creating a temporary hosts-file entry on the client machine. Apache’s getting-started guidance identifies /etc/hosts on Unix-like systems and C:Windowssystem32driversetchosts on Windows.

  1. Open the hosts file with administrator or root privileges.
  2. Add the server’s address followed by the exact test hostname, for example 203.0.113.20 www.example.test example.test. Use the server address reachable from that client.
  3. Save the file and request the hostname, not the numeric address, in the browser or HTTP client.
  4. Confirm that the page, access log and error log belong to the intended vhost.
  5. Remove the temporary entry when public DNS points to the correct server.

Using the IP address alone is not an equivalent test: it can select the first vhost because it does not supply the intended Host name.

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

Verify the parsed configuration before going live

Inspect virtual-host mapping

Run:

apachectl -S

On Windows, run:

httpd.exe -S

Apache documents these commands as a dump of the addresses and names it parsed. Read the output for the expected file, address and port, each ServerName and alias, and the indicated default vhost. This is the fastest way to detect that you edited an un-included file, selected the wrong port, mistyped a hostname or unintentionally placed another block first.

Run a syntax check and apply the change

  1. Run the normal configuration-syntax check for your distribution or custom installation.
  2. If the check reports an error, correct the first reported file and line before investigating later messages; one missing quote or closing section can create cascading errors.
  3. Only after a clean check, reload or restart Apache using the service method supplied by your platform.
  4. Run the -S inspection again if the service uses wrappers or multiple configuration trees.
  5. Send a request with the intended hostname and confirm the vhost-specific access log records it.

The exact service command is intentionally platform-dependent. A successful syntax check does not prove that the service manager restarted the instance you inspected, so correlate the service definition with the configuration path shown by -S.

Troubleshoot the failures that appear most often

Symptom Likely cause Correction
Changes never appear The edited file is not included, or Apache starts with a different file through -f. Review the active includes and startup definition, then confirm the file listed by apachectl -S or httpd.exe -S.
The wrong site answers The request’s hostname does not match ServerName/ServerAlias, or another vhost is first for the same address and port. Request the exact hostname, inspect the host-file mapping, remove duplicate names and check vhost order.
The site works on one port but not another The block is attached to a different address-and-port pair than the listener or request. Compare the <VirtualHost> value with the listening configuration and the port shown in the -S output.
Apache refuses to reload A syntax error, unmatched section, invalid path or unavailable directive prevents parsing. Run the platform syntax check, fix the first error reported, and test again before reloading.
A directory returns forbidden The filesystem permissions or the <Directory> authorization rules do not allow the Apache process to read it. Verify traversal and read permissions, then review the directory section for the intended Require rule.
Logs are empty or written elsewhere The vhost was not selected, the log path is invalid, or the process cannot write there. Confirm selection with a hostname request, inspect the parsed log directives and correct ownership or path permissions.
Windows paths fail to parse Backslashes or quoting were used in a way the configuration parser does not accept. Use forward slashes and quote paths containing spaces.

A repeatable workflow for adding another site

  1. Record the address and port on which the new site should answer.
  2. Locate the active main file, startup arguments and include directories.
  3. Create a site-specific file in an included location.
  4. Define one ServerName, any deliberate aliases, a valid document root, separate logs and an appropriate directory authorization section.
  5. Enable the file using the package mechanism when one exists.
  6. Run the platform syntax check.
  7. Run apachectl -S or httpd.exe -S and verify the expected file, names, address, port and default ordering.
  8. Use a temporary hosts-file mapping to test the Host-header match before changing DNS.
  9. Reload or restart Apache only after validation, then check the vhost-specific access and error logs.
  10. Remove temporary hosts-file entries and document the final file location so the next administrator does not edit the wrong configuration.

This workflow works across source builds, Debian-family packages, RHEL-family packages and Windows because it relies on what Apache actually parses rather than on a presumed universal path.

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.