You don't! I'm guessing that you have several domain names and want to have several web sites be served from your one computer. You do this by adding virtual host entries. Apache 2 has a special place already set up for these virtual hosts to be defined.
Have a look in /etc/apache2/
You should see 'sites-available' and 'sites-active' directories. Go into the 'sites-available' directory and place your virtual host entries in there .... one virtual host entry per domain that you own. You can also define various intrAnets that you want to serve internally to your own comptuers.
Here is an example of an intranet virtual host; however, the same code will apply for your domain:
Code:
<VirtualHost *>
ServerName intranet.xxxxxxxxxx.us
DocumentRoot /var/www/intranet
<Directory "/var/www/intranet">
Options All MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Here is code for a domain name that you just purchased and want to serve web content for:
Code:
<VirtualHost *>
ServerName xxxxxxxxxx.us
ServerAlias www.xxxxxxxxxx.us *.xxxxxxxxxx.us
DocumentRoot /var/www/xxxxxxxxxx.us
<Directory "/var/www/xxxxxxxxxx.us">
Options All MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
When you are done you will need to go into 'sites-active' directory and make symbolic links to those virtual hosts that you just made.
NEXT ... very important ... RESTART the web server like this:
Code:
/etc/init.d/apache2 restart
You also have to think about DNS. Your dns should point to your machine's ip address for each of the domains (virtual hosts) that you are serving.
REMEMBER: you have to have a DNS entry for xxxxxxxxxx.us AND www.xxxxxxxxxx.us
For your intrAnet ... you need to update your DNS server ... or (if you don't have DNS running on your machine) run around and update the /etc/hosts file on each of your computers.
-- Tony