The vaddvhost command greatly simplifies the process of setting up <VirtualHost> entries in your /usr/local/www/conf/vhosts.conf file. It is important, however, to understand the changes made to your configuration files, in case you ever need to edit them.
vaddvhost makes the following changes when adding a virtual host:
Creates a home directory for the Web site within the /www/vhosts/ directory, and also creates an htdocs and logs directory for it. A cgi-bin directory is also created, if you chose to add a separate cgi-bin for the virtual host.
Adds a Virtual Host entry to your /usr/local/www/conf/vhosts.conf file. The lines contained in this entry, which are enclosed within <VirtualHost> </VirtualHost> tags, are what actually allow the virtual host to function. A typical Virtual Host entry looks like the following:
<VirtualHost acme.com>
DocumentRoot /usr/local/www/vhosts/acme.com/htdocs
ServerName acme.com
ServerAlias www.acme.com
ServerAdmin webmaster@acme.com
LogFormat COMBINED
ErrorLog /usr/local/www/vhosts/acme.com/logs/error_log
TransferLog /usr/local/www/vhosts/acme.com/logs/access_log
HostNameLookups off
<Directory "/usr/local/www/vhosts/acme.com/htdocs">
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Directory "/usr/local/www/vhosts/acme.com/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Adds the virtual host to the list of domain names in your /etc/mail/local-host-names file. This list specifies which domain names can send and receive email from your Freedom server. If a domain name is pointed to your server but is not listed in this file, you may not be able to send or receive email addressed with that domain name.
If you chose to include a separate cgi-bin directory for the vhost’s CGI files, vaddvhost creates a cgi-bin directory in the virtual host’s home directory. To make it possible for CGI programs to execute properly from this directory, the following lines are also added to the Virtual Host entry in your /usr/local/www/conf/vhosts.conf file:
<Directory "/usr/local/www/vhosts/acme.com/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>