Virtual Host Setup: Assign specific website to IP (default)

July 17, 2016 270 views
LAMP Stack DigitalOcean Ubuntu

I just setup my droplet as a virtual host (LAMP + Ubuntu) and successfully added 5 websites! win! However, it seems to have chosen one of the five as the default when I visit my IP address directly. Is there a way to specify which site inside of /var/www/ the IP should default to?

1 Answer
gndo July 17, 2016
Accepted Answer

Look for the VirtualHost blocks in /etc/apache2/sites-enabled that you want to set as the default. Make the following change(s)

<VirtualHost  *:80>   or <VirtualHost *:443>


<VirtualHost _default_:80>   or  <VirtualHost _default_:443>

Make sure only one virtual host block is assigned the default (max one default per port). As you may already know, http URLs are usually assigned to port 80 and https URLs to port 443.

Have another answer? Share your knowledge.