You are now going to create two virtual hosts in your apache configuration.
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". It is these two names which we are going to use in our virtual host definition.
In this example of host-3-2, this machine is therefore 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 have a different name from the example. 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, you need to 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.
The VirtualHost information goes into a special file.
Create a file called "mysite.conf" in "/etc/apache2/sites-available/". Put your
two virtual host definition into that file.
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.
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.