Penguin
Note: You are viewing an old revision of this page. View the current version.

The process of virtually hosting multiple websites on a single IP address by using the requested name in the HTTP header.


An example for Apache would be:

in httpd.conf:

NameVirtualHost 12.34.56.78

<VirtualHost 12.34.56.78>
  ServerName example.com
  ServerAlias www.example.com
  ServerAdmin yourmum@example.com
  DocumentRoot /var/www/virtual/example.com
  CustomLog /var/log/apache/example.com-access.log combined
  ErrorLog /var/log/apache/example.com-error.log
</VirtualHost>


<VirtualHost 12.34.56.78>
  ServerName example2.com
  ServerAlias www.example2.com
  ServerAdmin yourmum@example2.com
  DocumentRoot /var/www/virtual/example2.com
  CustomLog /var/log/apache/example2.com-access.log combined
  ErrorLog /var/log/apache/example2.com-error.log
</VirtualHost>

The Name or IP used in the NameVirtualHost directive must be the same name or ip used in each VirtualHost.