8.Populate the file that you created in Step 7 with the following lines:

<HTML>

<HEAD>

</HEAD>

<BODY DIR="LTR">

<P ALIGN=CENTER STYLE="margin-bottom: 0cm"> <FONT FACE="Times New Roman, serif">

<FONT SIZE=6>This is www.website2.com</FONT> </FONT></P>

</BODY>

</HTML>

9.Configure virtual hosting by creating a file named

/etc/apache2/vhosts.d/vhosts.conf and adding the following lines:

NameVirtualHost *:80

<VirtualHost *:80>

DocumentRoot /srv/www/htdocs/website1 ServerName www.website1.com </VirtualHost>

<VirtualHost *:80>

DocumentRoot /srv/www/htdocs/website2 ServerName www.website2.com </VirtualHost>

10.Restart your Apache HTTP server for the changes to take effect.

11.Verify that the virtual hosting configuration operates properly by opening a browser and entering the following website:

www.website1.com

The following message appears:

This is www.website1.com

Open a second browser and enter the following website: www.website2.com

The following message appears:

This is www.website2.com

Using Apache HTTP Server URL Redirection

The following procedure illustrates the use of the URL redirection feature which allows you to configure the Apache HTTP server to send requests for one URL to another URL. This requires the use of two servers that are both running Apache HTTP server.

1.On the first server, create the following directory:

/srv/www/htdocs/testdir

2.On the second server, create the following HTML file:

/srv/www/htdocs/test.html

3.Add the following lines to the file you created in Step 2:

<HTML>

<HEAD>

</HEAD>

<BODY DIR="LTR">

<P ALIGN=CENTER STYLE="margin-bottom: 0cm"> <FONT FACE="Times New Roman, serif">

<FONT SIZE=6>The URL redirect is successful!</FONT> </FONT></P>

Installing, Configuring, and Managing Web Server Middleware Stack Components 23

Page 23
Image 23
HP 5991-5565 manual Using Apache Http Server URL Redirection, Configure virtual hosting by creating a file named