Default Virtual Host in Apache

If you have multiple domains installed in a virtual host configuration with one IP address in Apache, the IP address may not resolve to the domain you prefer. Let me explain.

For example, you have the following domains running on an Ubuntu Server with one IP address.

All the domains are resolving as expected on the browser.

However, if you type the IP address on the browser, it only defaults to the first domain found in the /etc/apache2/sites-available directory, which is most likely

If you want the IP address to default to another domain, such as for example, you will need to edit the /etc/apache2/httpd.conf file and add the following entries.

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

Those are the only entries you’ll need. Typing the IP address on the browser will now default to the contents of All the other domains are still accessible via domain names on the browser.