Virtual hosts not working. Getting a redirect to the default apache page.

Posted March 12, 2020 9.6k views

Hi! i made a doplet to deploy my wordpress applications and i create a virtual host with apache2. So, this is my .conf at /etc/apache2/sites-available/ :

# Added to mitigate CVE-2017-8295 vulnerability
UseCanonicalName On

<VirtualHost *:80>


        DocumentRoot /var/www/estilo_off

        <Directory /var/www/estilo_off>
            Options FollowSymLinks
            AllowOverride All
            Require all granted

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

But, when i type the domain in to the browser, i see the default page at /var/www/html. I really dont know what i miss ):

1 comment
  • found a solution but still not understanding…

    i have this file created at /etc/apache2/sites-enabled:


    which points to the domain but with the wrong documentRoot and directory.

    so i change that and its work now! but why the apache is using this file instead ?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hello, @mikhaelipcn

You can check this two tutorials:

and also:

One thing to keep in mind is that /etc/apache2/sites-available/

directory where per-site virtual hosts can be stored. Apache will not use the configuration files found in this directory unless they are linked to the sites-enabled directory. Typically, all server block configuration is done in this directory, and then enabled by linking to the other directory with the a2ensite command.

Basically you can create a symlinks like this:

ln -s /etc/apache2/sites-available/ /etc/apache2/sites-enabled/

Hope this helps.


by Justin Ellingwood
by Kathleen Juell
The Apache HTTP server is the most widely-used web server in the world. It provides many powerful features including dynamically loadable modules, robust media support, and extensive integration with other popular software. In this guide, you will learn how to install an Apache web server on your Ubuntu 18.04 server, as well as information about important Apache files and directories.