0

Possible Duplicate:
Setting up httpd-vhosts.conf for multiple virtual hosts

Say I have dedicated ip 155.5.5.5 I have all of the dns setup properly for two domains www.a.com and www.b.com

In my apache directory I have /var/www/a/ /var/www/b/

How do I setup the apache vhosts.conf file so that The ip (155.5.5.5) goes to /var/www/, A.com goes to /var/www/a, B.com goes to /var/www/b ?

tester
  • 565
  • 8
  • 18

1 Answers1

1

Use Name based virtual hosts

NameVirtualHost *:80

<VirtualHost *:80>
ServerName a.com
ServerAlias www.a.com
DocumentRoot /var/www/a
</VirtualHost>

<VirtualHost *:80>
ServerName b.com
ServerName www.b.com
DocumentRoot /var/www/b
</VirtualHost>

http://httpd.apache.org/docs/1.3/vhosts/name-based.html

Depending on your distro the virtual hosts go in /etc/apache2/sites-enabled/ or just the bottom of /etc/httpd/conf/httpd.conf.

The slicehost articles are great for starting out with linux sysadmin/apache/etc.

iainlbc
  • 2,694
  • 19
  • 19
  • Really appreciate the help. Was wondering how I might get the ip to go to the root directory? – tester Dec 14 '11 at 06:01