Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix 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
VGSources
Blog

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

Replace the Debian or Ubuntu Apache2 welcome page with your own index.html. Find the active virtual host, set the right DocumentRoot, configure DirectoryIndex, test safely, and troubleshoot stale or incorrect pages.
Length9 min Posted Quest giverVGSources Team
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 creating or editing /var/www/html/index.html. Apache serves that file when the request reaches the virtual host whose DocumentRoot is /var/www/html and the directory’s DirectoryIndex includes index.html. If you still see “It works!”, the request is usually reaching a different virtual host, directory, filename, or cached response.

The short procedure

  1. Find the virtual host that answers your hostname and note its DocumentRoot.
  2. Back up the existing index file outside the web root.
  3. Write your complete HTML document to that root as index.html.
  4. If you changed the document root, permit the new directory in Apache’s configuration when required.
  5. Run Apache’s configuration test. Reload Apache only if configuration changed.
  6. Open the site with the intended hostname and, if necessary, troubleshoot virtual-host selection, filename case, index ordering, or caching.

How Apache chooses the page for /

Apache does not search your entire server for a file named index.html. It first selects a virtual host, then maps the URL path into that host’s DocumentRoot. If the selected root is /var/www/html, a request for https://example.test/ maps to the directory /var/www/html/. A request for /work/ maps to /var/www/html/work/.

As an Amazon Associate I earn from qualifying purchases.

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.

Because the URL ends in a directory, Apache’s mod_dir module consults the DirectoryIndex directive. Apache documents index.html as the default value. Ubuntu’s packaged configuration in /etc/apache2/mods-available/dir.conf starts with this ordered list:

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

Apache checks the names from left to right and serves the first matching resource. Therefore, an existing index.php can be ignored when index.html appears first, while a file named Index.html does not match the lowercase entry on a case-sensitive Linux filesystem.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Find the active virtual host and document root

The packaged default site commonly uses /etc/apache2/sites-enabled/000-default.conf, but the file that answers your hostname may be another enabled site. A name-based virtual host is selected from the request’s hostname, so editing /var/www/html/index.html has no effect if your domain is being served by a different host configuration.

Open the enabled configuration and locate the DocumentRoot inside the relevant <VirtualHost> block:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo less /etc/apache2/sites-enabled/000-default.conf

You can also ask Apache to display its virtual-host map:

sudo apache2ctl -S

Use the hostname, address, and port shown by that output to identify the host that receives your request. Record the exact root path, including capitalization. That path—not a remembered default—is where the home page belongs.

Replace the page in the packaged default root

1. Back up the shipped page

Keep the original outside the public directory so Apache cannot serve the backup accidentally. A dated filename makes rollback straightforward:

sudo cp /var/www/html/index.html /var/backups/apache-index.html.$(date +%F-%H%M%S)

Create /var/backups first if it does not exist, and make sure the account running the command has permission to write there.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

2. Create your complete HTML document

Write a normal HTML document—not only a fragment—to the lowercase filename /var/www/html/index.html:

sudo nano /var/www/html/index.html

For example:

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

Save the file, then verify that it exists at the exact path:

ls -l /var/www/html/index.html

On the default Debian/Ubuntu site, changing the file itself does not require a service restart or reload. Apache reads the file for the next request. A reload is needed when you change Apache configuration, such as DocumentRoot or DirectoryIndex.

Use a custom document root instead

A separate site directory is useful when you want the web content outside the packaged tree. The change has two parts: point the active virtual host at the directory and ensure Apache is allowed to serve it.

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

1. Create the directory and page

sudo mkdir -p /srv/my-site
sudo nano /srv/my-site/index.html

Use the same lowercase index.html filename. The directory must contain the complete page you want returned for the site root.

2. Change the active virtual host

Edit the host that answers your hostname, commonly by creating or editing a file under /etc/apache2/sites-available/. Set its root to the directory you created:

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
<VirtualHost *:80>
    ServerName example.test
    DocumentRoot /srv/my-site

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

The exact ServerName, port, TLS settings, and other directives depend on your site. Do not paste this block over an existing production configuration without preserving its required directives. Enable the site if it is new, then disable a conflicting default site only when you are certain the intended host should receive the request:

sudo a2ensite my-site.conf
sudo a2dissite 000-default.conf

Debian’s packaged default-page text warns that a document root outside the usual location—for example, under /srv—may also need permission in /etc/apache2/apache2.conf. An appropriate <Directory> section, as shown above, is the place to express that access policy. Do not grant broad access to the entire filesystem merely to make one page work.

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

3. Test and reload

sudo apache2ctl configtest
sudo systemctl reload apache2

Proceed with the reload only if the configuration test reports success. A reload applies configuration without rebooting the machine. If your distribution uses a different service manager, use its equivalent reload operation.

Set a different home-page filename when necessary

You do not have to call the page index.html, but Apache must be told the name and order to try. For a host that should prefer home.html, add or change:

DirectoryIndex home.html index.html

Place the directive in the appropriate virtual-host or directory configuration, test the syntax, and reload Apache. The first existing candidate wins. If home.html exists, it will be returned before index.html; if it does not, Apache falls back to index.html.

Ubuntu’s packaged list also includes CGI, Perl, PHP, XHTML, and older HTML names. That ordering can explain why a page other than the one you edited appears. Inspect the effective configuration before changing it. Keep the list intentionally narrow on a public site so an obsolete file cannot silently become the home page.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

What happens when no index file exists

If none of the configured DirectoryIndex names exists, Apache does not automatically invent an HTML home page. A directory listing is generated only when the Indexes option is enabled. Without it, the request can be denied instead.

Directory listings expose filenames and are generally discouraged on a public DocumentRoot. Creating a file with an arbitrary name and enabling listings is not a substitute for choosing a deliberate home page. Add the correctly named index resource or configure an intentional application entry point instead.

Verify the result without trusting a stale browser tab

  1. Request the intended hostname, not merely the server’s IP address. The hostname determines which name-based virtual host is selected.
  2. Open the root URL with a fresh browser window or private session.
  3. Compare the response with a command-line request, for example curl -i http://example.test/, replacing the hostname and scheme used by your site.
  4. Confirm that the response body contains a distinctive string from your new page.
  5. If the browser and command-line response disagree, inspect response headers and any reverse-proxy or browser cache before editing Apache again.

A successful file change can be hidden by a cached response. A fresh request and the server’s access or error logs provide a better indication of what Apache actually returned.

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

Diagnose the “It works!” page and other failures

You edited the wrong file

This is the most common cause. Check the selected virtual host and its DocumentRoot. If the host points to /srv/my-site, changing /var/www/html/index.html cannot change that response. Use apache2ctl -S and inspect the matching host configuration.

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

The filename or capitalization is wrong

The configured name is exact. Index.html, home.html, and index.HTML are different names on a typical Linux filesystem. Rename the file to the configured lowercase name or change DirectoryIndex deliberately.

Another index file wins

Look at the complete ordered list, not just whether index.html appears somewhere in it. If an earlier candidate exists, Apache serves that file. Remove the unintended candidate or put your preferred name first, then test and reload the configuration.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

The custom directory is denied

A root outside the usual Debian/Ubuntu locations may not be permitted by the server’s directory rules. Add a narrowly scoped <Directory> rule for the intended root, ensure the path is traversable by the Apache service account, run apache2ctl configtest, and reload. Read the error log for the specific denied path instead of granting access to a parent such as /.

No index file is present

If every configured index candidate is missing, you may receive a forbidden response rather than a page. Check the directory contents and the effective DirectoryIndex. Do not enable public listings merely to hide the missing-file problem.

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

A proxy or browser is serving an old response

Use a fresh request and inspect headers. If the command-line request shows the new body but the browser does not, clear the relevant cache or investigate an intermediary. If both show the old page, return to virtual-host and document-root checks.

Configuration reload fails

Never continue after a failed syntax test. Read the reported file and line, correct the directive or path, rerun sudo apache2ctl configtest, and only then reload. A reload is not a repair for invalid configuration.

Choose between the default root and a custom root

Decision point Keep /var/www/html Use a custom DocumentRoot
File location /var/www/html/index.html An explicit directory such as /srv/my-site/index.html
Virtual-host edit Usually none for the packaged default site Required in the active <VirtualHost> block
Directory permission work Handled by the packaged site’s existing rules May require a narrowly scoped <Directory> rule and filesystem access
Best fit A single simple site or a quick replacement of the welcome page Multiple sites, a separately managed deployment tree, or content intentionally kept outside the packaged root
Main risk Assuming it is active when another host serves the hostname Forgetting virtual-host selection or access permission

In both setups, the same two rules decide the result: DocumentRoot maps the URL to a filesystem tree, and DirectoryIndex chooses the first matching filename in that directory.

Rollback safely

If the new page causes a problem, restore the backup to the same active root:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo cp /var/backups/apache-index.html.YYYY-MM-DD-HHMMSS /var/www/html/index.html

Replace the example backup name with the actual dated file. If you changed the virtual host as well, restore that configuration, run the configuration test, and reload only after it passes. Keeping content rollback separate from configuration rollback makes it clear which change caused the failure.

Operational checklist

  • The request uses the hostname intended for the site.
  • The selected virtual host’s DocumentRoot is known and contains the page.
  • The file is named exactly as the relevant DirectoryIndex entry, including case.
  • Any earlier index candidate has been removed or intentionally retained.
  • A custom root has an appropriate, narrowly scoped directory permission rule.
  • sudo apache2ctl configtest succeeds after configuration edits.
  • Apache has been reloaded after configuration edits.
  • A fresh request confirms the new response body, rather than relying on a cached tab.

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 quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver 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.