You now need to create a virtual host file to hold your virtual hosts.
Create a file called "mysite" in "/etc/apache2/sites-available/". Put your
virtual host definition into that file.
Using the <VirtualHost> tags in this mysite file (add them into
the file) create two VirtualHosts. Remember this file
is "/etc/apache2/sites-available/mysite"
Once the file exists you need to activate it using
a2ensite mysite
Remember to reload your apache2 service after enabling the site, and after
every configuration change.
The names of your virtual hosts have to be worked out by yourself from
your current hostname. Type in the command "hostname" and you will get
something like:
host-3-2.linuxzoo.net
Your machine is known by this name in DNS. It is also known by two other
names, where the word "host" has been replaced with "web" and "vm".
In this example of host-3-2, this machine is also known as:
web-3-2.linuxzoo.net
vm-3-2.linuxzoo.net
IMPORTANT: Do not just copy this example, as your machine number is likely
to be entirely different. Use "hostname" and work your machine names out for
yourself. Note too that your hostname can change each time you reboot, so
double check each time you reboot!
Once you have your web and vm machine names, create a virtual host entry
for each of web-?-?.linuxzoo.net and vm-?-?.linuxzoo.net, so that the
DocumentRoot of web is /home/dave/public_html/web and the DocumentRoot
of vm is /home/dave/public_html/vm.
Each VirtualHost tagged area (you need 2) looks something
like:
<VirtualHost *:80>
ServerAdmin me@grussell.org
DocumentRoot /home/gordon/public_html/db/public_html/activesql
ServerName sql.grussell.org
</VirtualHost>
Remember to set the ServerName and the DocumentRoot. The other fields are not
important. Remember DocumentRoot is a directory not a file.
It is easy to make a syntax error in the config file. If you have problems
you can check for syntax errors using the command:
apache2ctl -t
You should now be able to view your own pages by using your browser, opening
a new window, and visiting e.g. http://vm-?-?.linuxzoo.net/hello.html, after
replacing the "?" with the actual numbers. Try it for "web" too.