Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk8 min

How to Replace the Apache2 Default Page With Your Own index.html

A practical guide to replacing Apache2’s default page on Debian and Ubuntu, including virtual-host selection, DocumentRoot, DirectoryIndex order, custom roots, permissions and troubleshooting.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

On a standard Debian or Ubuntu Apache2 installation, replace the welcome page by writing your complete HTML document to /var/www/html/index.html. Apache serves that file because the default virtual host uses /var/www/html as its DocumentRoot and the directory-index configuration tries index.html first.

If the hostname is handled by another virtual host, or that host points to a different directory, edit the DocumentRoot selected for that request instead. The reliable method is to identify the active virtual host, back up its current index, create the new file, test any configuration change, and then verify the response using the intended hostname.

As an Amazon Associate I earn from qualifying purchases.

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

How Apache chooses the page for /

Apache does not search your whole server for a file named index.html. It combines two settings:

  • DocumentRoot maps a URL path to a filesystem tree. With /var/www/html as the root, a request for / starts in /var/www/html; a request for /work/ starts in /var/www/html/work/.
  • DirectoryIndex, handled by mod_dir, lists the filenames Apache tries when the request names a directory. Apache returns the first candidate that exists.

Apache’s documented default is DirectoryIndex index.html. Ubuntu’s packaged configuration is in /etc/apache2/mods-available/dir.conf and normally begins with index.html index.cgi index.pl index.php index.xhtml index.htm. Therefore, a correctly named index.html in the active document root normally wins without any additional setting.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
Setup Where the home-page file belongs What must match
Packaged default site /var/www/html/index.html The request must select the default virtual host.
Custom virtual host The active host’s DocumentRoot followed by index.html The hostname, virtual-host configuration, directory permissions and filename must all be correct.
Subdirectory For example, /var/www/html/work/index.html The URL must request /work/, and the directory-index list must include the desired filename.

Replace the page on the standard Debian or Ubuntu site

1. Identify the virtual host and its document root

The default site is commonly enabled as /etc/apache2/sites-enabled/000-default.conf, but do not assume it is handling your request. A different enabled site can have a different root, and Apache serves the file belonging to the virtual host selected for the request’s hostname.

Inspect the loaded virtual hosts and their roots before editing:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo apache2ctl -S
sudo grep -R "DocumentRoot" /etc/apache2/sites-enabled/

Read the matching host configuration and note the exact DocumentRoot. If your server has several names or aliases, test with the same hostname that visitors use; opening the server by an address or an unrelated name can select another host.

2. Back up the packaged page

Keep the existing file outside the web root so Apache cannot publish the backup as another downloadable page. For the packaged site, for example:

sudo install -d /var/backups/apache2
sudo cp -p /var/www/html/index.html /var/backups/apache2/index.html.$(date +%F)

If the active root is elsewhere, substitute that root. A dated copy lets you restore the previous page without guessing which version was live.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

3. Write a complete index.html

Replace the file in the active root. Using an editor is fine:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo nano /var/www/html/index.html

Save a complete document rather than a fragment. This minimal example is enough to prove that Apache is serving your file:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>My site</title>
</head>
<body>
  <h1>My site is live</h1>
  <p>This page is served by Apache2.</p>
</body>
</html>

Use the exact lowercase name index.html. Linux filesystems are normally case-sensitive, so Index.html is a different resource. Put images, stylesheets and scripts in paths relative to this document, and confirm those paths also exist below the same document root.

4. Decide whether Apache needs a reload

Changing only the contents of an existing index.html does not require an Apache reload; the next request reads the new file. A reload is required when you change a virtual-host file, DocumentRoot, DirectoryIndex or an access rule.

Before reloading, run the configuration test used by the Debian-family packages:

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 #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
sudo apache2ctl configtest

Proceed only when it reports a successful syntax check. Then apply the change without rebooting the machine:

sudo systemctl reload apache2

If your distribution exposes the equivalent command as apachectl, use that command according to its service-management conventions. A failed configuration test should be corrected before any reload; otherwise a valid running configuration may remain in place while you investigate.

5. Request the root using the intended hostname

Open the site root in a private browser window or make a fresh request. A command-line check makes the response easier to inspect:

curl -i http://your-hostname/

Confirm that the returned body contains text from your new file and that the response is from the expected host. If you changed only the HTML and the browser still shows the welcome page, first bypass the browser cache and compare the response with a fresh request before changing Apache settings.

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

Use a different directory as the DocumentRoot

A custom root is useful when each site needs its own directory or when you do not want to keep application files directly under /var/www/html. In that arrangement, the file is not /var/www/html/index.html; it is index.html under the root of the virtual host that receives the request.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

Example virtual-host arrangement

Create the site directory and its index file, then adjust the existing virtual-host configuration rather than editing an unrelated site:

sudo install -d /srv/example-site
sudo nano /srv/example-site/index.html
sudo nano /etc/apache2/sites-enabled/000-default.conf

The relevant configuration has the following shape; retain the host’s existing names and other directives when adapting it:

<VirtualHost *:80>
    ServerName example.test
    DocumentRoot /srv/example-site

    <Directory /srv/example-site>
        Require all granted
    </Directory>
</VirtualHost>

The DocumentRoot line changes URL-to-filesystem mapping. The Directory block permits Apache to serve that tree on Apache 2.4 installations; access rules in your existing configuration may differ, so do not delete more specific restrictions merely to make the page appear.

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

Permit a nonstandard root

Debian’s packaged welcome page warns that a root outside the usual location, such as /srv, may also need to be allowed in /etc/apache2/apache2.conf. If Apache returns an access error after the root change, inspect the applicable <Directory> rules and add a narrowly scoped rule for the actual site directory. Do not grant access to the entire filesystem simply because one site lives below /srv.

Test, reload and verify the custom site

  1. Run sudo apache2ctl configtest and fix every reported syntax error.
  2. Reload with sudo systemctl reload apache2.
  3. Request the site with its configured hostname, not merely with an address that could select another virtual host.
  4. Check that the new file is exactly /srv/example-site/index.html (or the root you configured) and that its parent directories allow Apache to traverse and read them.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Make sure DirectoryIndex selects your file

If an index with another name is being served, inspect the active directory-index order. Ubuntu’s packaged list is found in /etc/apache2/mods-available/dir.conf and starts with:

DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm

Apache checks the names from left to right and stops at the first existing resource. This explains several common surprises:

  • Index.html, home.html or a file in a different directory is not a replacement for index.html unless the configuration explicitly names it.
  • If index.html is absent but index.php exists and appears later in the list, Apache can serve the PHP file instead.
  • A request for /work/ uses the index file inside /work, not necessarily the index at the document root.

For a different preferred filename, edit the applicable configuration so that name appears in the desired position, then run the configuration test and reload. If your goal is specifically to use index.html, leaving it first is the least surprising arrangement.

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

What happens when no index file exists

When none of the configured index resources exists, Apache can generate a directory listing only if Options Indexes is enabled for that directory. Without that option, the request may be denied instead of showing a page. Ubuntu cautions that directory listings generally should not be enabled on a public DocumentRoot: they disclose filenames and often reveal files that were never intended as web pages.

The safer fix for a missing home page is to create the correctly named index file or correct the directory-index configuration. Do not enable listings merely to hide a deployment mistake.

Troubleshoot “It works!” or the old page still appearing

Symptom Likely cause Targeted check or fix
The old welcome page remains after editing. The request selected a different virtual host. Compare the hostname you requested with the host definitions reported by sudo apache2ctl -S, then edit that host’s DocumentRoot.
The file exists, but Apache ignores it. The filename or capitalization does not match the directory-index list. Use exactly index.html, inspect /etc/apache2/mods-available/dir.conf, and check whether an earlier candidate already exists.
A custom root returns an access error. The directory is outside the usual path and is not permitted by Apache configuration. Review the matching <Directory> rule in the virtual-host configuration and, where necessary, /etc/apache2/apache2.conf. Permit only the intended site directory.
The root returns a forbidden or empty response. No configured index resource exists, and directory listing is disabled. Create the index file in the selected root or correct DirectoryIndex; do not turn on public listings as a workaround.
The browser shows an earlier version while a direct request is current. A browser or intermediary cache is serving a stale response. Use a private window, make a fresh request, compare response headers and inspect server logs before changing the file again.
The new configuration will not load. A syntax error was introduced in the virtual-host or directory configuration. Run sudo apache2ctl configtest, correct the line it reports, test again, and reload only after a successful result.

Choosing between the default root and a custom root

Both arrangements can serve the same index.html; the practical difference is where Apache looks and which host receives the request.

Decision point Keep /var/www/html Use a custom DocumentRoot
Initial work Edit the packaged file directly. Create a directory and modify the active virtual host.
Virtual-host changes Usually none for the default site. Required so the host points to the new tree.
Access configuration Usually covered by the packaged defaults. May require a matching <Directory> rule, especially outside the usual web path.
Multiple sites Less separation between deployments. Each host can have its own files, logs and index page.
Failure to check You may edit the default page while another host is serving visitors. You may point the host at an empty or inaccessible directory.

For a single test site, retaining the packaged root is the shortest path. For multiple hostnames or a deliberate filesystem layout, a separate root is clearer, provided you verify virtual-host selection and access rules.

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.

Operational checks before calling the change complete

  • The intended virtual host and its DocumentRoot are documented for whoever maintains the server.
  • The old index is backed up outside the web root.
  • The new file is named exactly index.html and contains a complete HTML document.
  • Any virtual-host, directory or index-order change passes apache2ctl configtest before reload.
  • The response is tested with the real hostname, including a fresh request that is not relying on browser cache.
  • No public directory listing was enabled merely to compensate for a missing index.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.