We've expanded our news coverage and improved our search!
for the latest or search for all things across O'Reilly!
Simplify Your Life with Apache Virtual Hosts
sample virtual host configuration file
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:
Allow from all
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"
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
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.