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”.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s