首页/Home Web服务器 Installation Configure Apache Virtual Host

Configure Apache Virtual Host

PrintE-mail
Sunday, 03 February 2008 17:00  

This article tells how to add virtual hosts on your apache server.
Generally, there are only three easy steps.

On Linux systems, take Ubuntu for example

1. Go to '/etc/apache2/sites-available/', open 'default' file, add the following lines at the bottom:

<VirtualHost *>
ServerName www.otherdomain.tld
DocumentRoot /www/otherdomain
</VirtualHost>

Then close the file.

2. Restart apache:

sudo /etc/init.d/apache2 restart

3. Open '/etc/hosts', add the following line at the top:

127.0.0.1 www.otherdomain.tld

Close the file. Open your browser, type

www.otherdomain.tld

You'll see it.