Strictly Programming

Setting up Virtual hosts in Apache HTTP Server 2

Posted in Uncategorized by sqllyw on 12/06/2008

Apache Virtual Host documentation

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
mkdir /var/www/
mkdir /var/www/

put a index.html in each of the newly created directory

4. update httpd.conf as follow:

NameVirtualHost *:80

<VirtualHost *:80>
ServerAlias *
DocumentRoot /var/www/

<VirtualHost *:80>
DocumentRoot /var/www/

Restart your server, and try the commands in the step3, you will see the browser opens two different index.html in the step 4.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: