Virtual Host only one site works with its domain name

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?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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!

Regards, KDSYs