Apache Virtual Hosts

Apache web server offers the ability to serve different web sites on different domain within the same server. All you need to do is to specify the right virtual host entry in the httpd.conf file. For example:

<VirtualHost *>
    ServerAdmin webmaster@domain.com
    DocumentRoot /usr/local/www/data/site1
    ServerName www.domain.com
    ErrorLog logs/domain.com-error_log
    CustomLog logs/domain.com-access_log common
</VirtualHost>

The asterisk *defines that the website should be served no matter the host IP. If you want you can specify IP and port in the following way: “xxx.xxx.xxx.xxx:Y”.

Advertisement