Posted by: jasonk2600 | November 30, 2009

Quickie HowTo: Apache Virtual Hosts

Virtual Host by Domain Name

To configure Apache to serve a different Web site dependant upon the domain name the user provides setup a Virtual Host in httpd.conf as follows.  NOTE:  Replace /www/test with the path to your Web site files and replace test.yourdomain.com with the host and domain name of your web site.

NameVirtualHost *:80

<VirtualHost  *:80>
   DocumentRoot /www/test
   ServerName test.yourdomain.com
</VirtualHost>

 

Virtual Host by Port Number

To configure Apache to serve a different Web site dependant upon the port number the user provides, setup a Virtual Host in httpd.conf as follows. NOTE: Replace /www/test-8080 with the path to your Web site and replace 8080 with the port number you wish to use.

Listen 8080

<VirtualHost *:8080>
   DocumentRoot /www/test-8080
   ServerName test.yourdomain.com
</VirtualHost>

 

  [EoF]
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

Categories

%d bloggers like this: