Wednesday, December 29, 2010

HTTP/HTTPS -- Configure a virtual host

HTTP virtual hosts allow a single web server to act like multiple web servers, either by publishing to multiple IPs and ports, or by publishing multiple sites and identifying them by name. This feature allows you to publish http://foo.example.com and http://bar.example.com from the same host with a single address, and the server returns the appropriate information based on the site name the customer has typed in.


STEP 1: Create directories to hold the content
cd /var/www
mkdir foo
mkdir bar
echo foo > foo/index.html
echo bar > bar/index.html

STEP 2: Create virtual directories
vi /etc/http/conf/httpd.conf
uncomment the line NameVirtualHost *:80
copy the last 7 lines twice, remove the # at the beginning
edit the DocumentRoot and ServerName lines to match your new directories
Save the file and execute service httpd restart
Test

3 comments:

mind.it said...

Wonderful illustrated information. I thank you about that. No doubt it will be very useful for my future projects. Would like to see some other posts on the same subject! pure vpn

Irfan Ali said...

Most of the time I don’t make comments on websites, but I'd like to say that this article really forced me to do so. Really nice post! Netflix DNS

LG G@ said...

Thanks you very much for sharing these links. Will definitely check this out.. Cheap VPN