From Bashlinux
Jump to: navigation, search

How to serve multiple virtual hosts with one configuration file

The following Apache configuration is useful to serve web content for multiple users from their home folder but with only one configuration file

UseCanonicalName Off

<VirtualHost *:80>
	ServerName bashlinux.com
	ServerAlias *.bashlinux.com

	VirtualDocumentRoot /home/%1/htdocs
	VirtualScriptAlias /home/%1/cgi-bin

	<Directory />
		Options -Indexes FollowSymLinks -MultiViews
		AllowOverride All
		Order allow,deny
		Allow from all

	<DirectoryMatch "^/home/[^/]+/cgi-bin">
		AllowOverride None
		Options ExecCGI