How to Set Up Linux Apache Server
Page 18: Set Up Your First Virtual Host (Part 1)
If all the above testing is passed, it means that your Apache Webserver is working normally. Now, the important moment come. You have to set up your first virtual host in your webserver.
This is suggested that all virtual account should be created under the /var/www/html directory.
In Chapter 7 of this Linux Apache Server tutorial series, we have registered a new domain (YourDomain.com). We will use this domain as an example. We will create the first Virtual Account of your new domain (YourDomain.com) under the /var/www/html directory. Okay! Let's start.
1. Create a new directory for the Virtual Account
Open a command window. Move to the home directory:
Create a new directory (yourdomain) for the virtual account.
Move to yourdomain directory
Create a public_html directory for yourdomain virtual account.
I am sure you are familiar with this public_html directory. All webpages of yourdomain Virtual Account must be saved in the public_html directory.
2. Prepare a Homepage
Prepare a homepage with the file name index.html. Then save the homepage inside the /var/www/html/yourdomain/public_html directory.