Women in Technology

Hear us Roar



Article:
  Simplify Your Life with Apache Virtual Hosts
Subject:   sample virtual host configuration file
Date:   2003-07-28 18:45:31
From:   bjarnedm
I like to completely separate my virtual hosts from each others, so I can move a complete directory around without worrying that much, so my standard configuration looks something like this:


<VirtualHost *>
ServerAdmin webmaster@virtual-host.net
ServerName www.virtual-host.net
ServerAlias virtual-host.net
DocumentRoot /Volumes/WebServer/virtual-host/Documents
<Directory "/Volumes/WebServer/virtual-host/Documents">
Options None
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ "/Volumes/WebServer/virtual-host/cgi-bin/"
ErrorDocument 404 /messages/404.html
php_value include_path ".:/Volumes/WebServer/virtual-host"
php_value session.cookie_domain "virtual-host.net"
php_value session.save_path "/Volumes/WebServer/virtual-host/php-sessions"
php_value session.use_only_cookies "1"
ErrorLog "/Volumes/WebServer/virtual-host/logs/error_log"
CustomLog "/Volumes/WebServer/virtual-host/logs/referer_log" referer
CustomLog "/Volumes/WebServer/virtual-host/logs/agent_log" agent
CustomLog "/Volumes/WebServer/virtual-host/logs/access_log" common
</VirtualHost>


I also set several php values. The reason for the php-includes directory being the folder containing the virtual host is that sometimes I want to keep the php-includes completely outside of the Documents folder for security reasons, and at other times I want them to be located close to where they are used.