Virtual host config

Virtual hosts in Apache are the same thing as host headers in Windows IIS, allowing the admin to have multiple websites on one webserver with one IP-address.

1. Create a folder for the new virtual host.
# sudo mkdir /var/www/www.mysite.com

2. Change owner on the virtual host folder. www-data is the same as IUSR under Windows.
# sudo chown -R www-data /var/www/www.mysite.com

3. Edit the Apache configuration file.
# sudo vi /etc/apache2/sites-enabled/000-defualt

4. Add the following text at the end of the file.
<VirtualHost *>
DocumentRoot /var/www/www.mysite.com
ServerName www.mysite.com
ServerAlias mysite.com
</VirtualHost>

5. Restart Apache to use the new configuration.
# sudo /etc/init.d/apache2 restart

http://httpd.apache.org/docs/1.3/vhosts/

Leave a Comment