Linux Server Domain Virtual Hosts are used to run more than one domain off of a single IP address.
1. Create a Directory.
sudo mkdir -p /var/www/yourdomain.tld/public_html
2. Grant Permissions.
sudo chown -R $USER:$USER /var/www/yourdomain.tld/public_html
sudo chmod -R 755 /var/www
3. Create a page.
sudo nano /var/www/yourdomain.tld/public_html/index.html
Type in nano “Your domain is set up!” then Save and Exit
4, Create the new Virtual Host File.
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/yourdomain.tld.conf
5. Turn on Virtual Hosts in the configuration.
sudo nano /etc/apache2/sites-available/yourdomain.tld.conf
Change or Add the following lines.
sudo a2ensite yourdomain.tld
6. Restart Apache
sudo service apache2 restart
Domain Virtual Hosts
To use name-based virtual hosting, you must designate the IP address (and possibly port) on the server that will be accepting requests for the hosts. This is configured using the NameVirtualHost directive. In the normal case where any and all IP addresses on the server should be used, you can use * as the argument to NameVirtualHost. If you’re planning to use multiple ports (e.g. running SSL) you should add a Port to the argument, such as *:80. Note that mentioning an IP address in a NameVirtualHost directive does not automatically make the server listen to that IP address. See Setting which addresses and ports Apache uses for more details. In addition, any IP address specified here must be associated with a network interface on the server.
The next step is to create a <VirtualHost> block for each different host that you would like to serve. The argument to the <VirtualHost> directive must match a defined NameVirtualHost directive. (In this usual case, this will be “*:80”). Inside each <VirtualHost> block, you will need at minimum a ServerName directive to designate which host is served and a DocumentRoot directive to show where in the filesystem the content for that host lives.