Setting up Virtual hosts in Apache HTTP Server 2
1. First, make sure you already have an Apache HTTP server running:
2. Now add following lines to your hosts file:
try to do following, it will be pointing at the same site as what we did in #1.
3. Create two document roots for the two virtual hosts
put a index.html in each of the newly created directory
4. update httpd.conf as follow:
NameVirtualHost *:80 <VirtualHost *:80> ServerName www.venus.com ServerAlias venus.com *.venus.com DocumentRoot /var/www/venus.com </VirtualHost> <VirtualHost *:80> ServerName www.mercury.com DocumentRoot /var/www/mercury.com </VirtualHost>
Restart your server, and try the commands in the step3, you will see the browser opens two different index.html in the step 4.