Virtual Host only one site works with its domain name

Posted February 16, 2020 945 views

I followed the tutorial for setting up virtual hosts on apache with Ubuntu 18.04. One of my sites is running and findable using it’s domain name (I own both domains). The other is only findable if I type in the server IP. Any suggestions on where to look for errors in my config?

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

Hi @chsoneal,

Can you confirm you’ve created separate Vhost files for your websites?
If you haven’t please make sure you have like so

Create the Vhost for your domain in Directory - /etc/apache2/sites-available/ where is your domain name. The file should contain the following

<VirtualHost *:80>
    DocumentRoot /var/www/

    <Directory /var/www/>
        Options -Indexes +FollowSymLinks
        AllowOverride All

    ErrorLog ${APACHE_LOG_DIR}/
    CustomLog ${APACHE_LOG_DIR}/ combined

Please note, you’ll need to replace with your domain name. Once you have created your website, type in the following

sudo a2ensite

And then create your symlink

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

Restart your Apache and you are ready to go!


  • Hi KPSys,

    I followed this tutorial and created two virtual hosts(sites).
    I later on also installed Let’s Encrypt SSL for both.

    Thus, I can now see 4 conf files under sites-available (2 for HTTP and 2 for HTTPS).
    I do not remember if I explicitly ran the ln command, but I can see 4 links under sites-enabled.

    I have created A records for both the domain at my domain provider’s end. One site is working properly but the other shows an error “This site can’t be reached”.

    Unable to understand the issue, please guide.

    Saurabha J

    by Lisa Tagliaferri
    This tutorial will guide you through setting up multiple domains and websites using Apache virtual hosts on an Ubuntu 18.04 server. During this process, you’ll learn how to serve different content to different visitors depending on which domains they are requesting.
    • I was able to identify the issue. It was related to my browser.

      Some issue with my Chrome browser, even after incognito and multiple cache clearings, it wasn’t showing the other site.

      • Hi @sau6402,

        It’s good to know that you were able to identify and resolve your issue! Can you please share the exact problem you were experiencing and how you fixed it in case anyone else stumbles on this problem and question?