Apache Virtualhost

apache

How can we set up a Virtual Host?

Create a vhost.conf file:

NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot "/usr/local/apache2/docs/thegeekstuff"
    ServerName thegeekstuff.com
    ServerAlias www.thegeekstuff.com
    ErrorLog "logs/thegeekstuff/error_log"
    CustomLog "logs/thegeekstuff/access_log" common
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/usr/local/apache2/docs/top5freeware"
    ServerName top5freeware.com
    ServerAlias www.top5freeware.com
    ErrorLog "logs/top5freeware/error_log"
    CustomLog "logs/top5freeware/access_log" common
</VirtualHost>
  1. http://www.thegeekstuff.com/2011/07/apache-virtual-host/

How can we dynamically configured mass virtual hosting?

If you are following instruction from http://httpd.apache.org/docs/2.0/vhosts/mass.html to set up name-based virtual hosts, you must use the LogFormat directives mentioned. Not sure why, but haven't got time to verify.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License