I just installed Apache on my Ubuntu 12.04 and set it up to run with my domain name. Everything is working perfect, with one qualm. Though my site is up, and when I type mydomain.com/index.html, the index page loads, or suppose I type mydomain.com/directory, the index.html page in that directory loads automatically, I am facing problems with the home page. Yes, when I type mydomain.com the Apache test page loads instead of my actual page. I suspect that the problem might be pertaining to me not setting the correct DirectoryIndex directive, I tried fixing it by going to /etc/apache2/apache2.conf, but I don't think I'm placing it in the right place. Any assistance would be appreciated! :)

EDIT: Typing localhost does lead me to my homepage, though.

Dani AI

Generated

Good find by — a browser cache often "freezes" the old Apache test page even after the server is serving the right files. For anyone who still sees the default page after replacing index.html, the usual causes are: the wrong virtual host is answering requests, the site’s DocumentRoot still contains an index file, the DirectoryIndex order prefers a different file, or the distro default site is still enabled.

The filename Apache chooses for a directory request is controlled by the DirectoryIndex directive (default includes index.html). See the Apache mod_dir docs for the behavior. mod_dir — DirectoryIndex. (httpd.apache.org) On Debian/Ubuntu the packaged default list lives in /etc/apache2/mods-available/dir.conf, so changing apache2.conf alone may not take effect unless you override it in your virtual host. Ubuntu Apache configuration notes. (documentation.ubuntu.com) Use apache2ctl -S to see which vhost is actually handling requests and which site is the default. Virtual host debugging (apachectl -S). (httpd.apache.org)

Quick, practical checks and commands:

sudo apache2ctl -S
sudo grep -R '^DocumentRoot' /etc/apache2
sudo find /var/www -maxdepth 2 -type f -name 'index.*'
curl -I http://yourdomain.example

If the DirectoryIndex ordering needs changing, edit /etc/apache2/mods-available/dir.conf or put a DirectoryIndex line in your site’s <VirtualHost> and reload Apache. On older Ubuntu (12.04) the distro default DocumentRoot is /var/www and the default site file may be named default (newer installs use 000-default), so check /etc/apache2/sites-available. (cwiki.apache.org)

If the page is still cached, test with curl -I or a private window. Note Ubuntu 12.04 reached end-of-life on April 28, 2017 — consider upgrading for security and modern defaults. (wiki.ubuntu.com)

Thanks to for pointing toward the webroot check and to for reporting the cache solution — the commands above will help if the problem is truly server-side.

Recommended Answers

All 2 Replies

Hello,

Go to your website directory in "/var/www/html/" and check the index.html.
In case it is correct (i.e. the index page of your website), restart apache and it should work.

Hope this help.

, I did this 1000 times, but it did not work. However, I have solved the problem myself. It was just a matter of clearing my browser's cache and restarting my browser. The home page is loading properly now, and the test page has gone. Thanks for your help, though! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.