Apache alternate between default page and home page

April 7, 2017 169 views
Apache Ubuntu 16.04

I have droplet running Ubuntu 16.04 and LAMP stack

I have 3 sites enabled:
one at /var/www/html (default apache config)
two at /var/www/others/SITE/public_html

My sites are showing well, but one of then sometimes shows my site and sometimes shows apache default page

Notice, there is no default page at /var/www/html/index.html because I my first site are installed there. All said, my 'It Works' page is the Digital Ocean version, instead the regular apache (that is sometimes shown on my site).

You can check this behaviour at:
drg.adv.br

When I open a private window the website sometimes shows the apache default page, I close the page, open private window again and my regular website.

My apache conf:

cat /etc/apache2/sites-enabled/drg.adv.br.conf 
<VirtualHost *:80>
    ServerName drg.adv.br
    ServerAlias www.drg.adv.br

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/others/drg.adv.br/public_html

        <Directory /var/www/others/drg.adv.br/public_html/>
        Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        <IfModule mod_dir.c>
            DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
        </IfModule>

</VirtualHost>

Ls to site folder:

ls /var/www/others/drg.adv.br/public_html/
css  font  images  index.htm  index.html

What I'm missing?

This should be due to high acess to the site?

2 Answers

I've sent ~ 50 requests to drg.adv.br and it's never the default page. Clear your browser cache.

  • Hi @Woet , thank you for your answer.

    I have a doubt:
    As far as I know at private window there in no cache, isnt't?

    If there is, why sometimes it's opens my regular site and sometimes it shows apache defaul page?

    • Caching still applies to incognito, and I don't know - all I can say is that it works fine.

@JonathanBatista

Testing your site on Chrome + Safari on MacOS and Chrome, FireFox (Dev), and IE on Windows 10, I'm not able to reproduce the issue when visiting the site, whether I'm using a normal browser window or a private window.

That being said, for DirectoryIndex, unless you need to allow each type, I'd simply reduce those to what's needed and I would start with the default for the site.

So if all your files are HTML files:

DirectoryIndex index.html

If you're mixing HTML and PHP:

DirectoryIndex index.php index.html

etc.

For me, at least on the user end, your index.html and index.htm files are showing the same thing, so I'd simply rely on index.html unless there's a need for the index.htm file.

Have another answer? Share your knowledge.