<VirtualHost *:80>
#   General setup for the virtual host
	ServerName lab.mitty.jp
	ServerSignature On

	LogLevel warn
	ErrorLog "|/usr/sbin/rotatelogs /var/log/apache2/error_lab_%Y%m%d_log 86400 540"
	CustomLog "|/usr/sbin/rotatelogs /var/log/apache2/access_lab_%Y%m%d_log 86400 540" combined

	DocumentRoot "/var/www/lab"
	<Directory />
		Options FollowSymLinks
		AllowOverride None
		Order Deny,Allow
		Deny from all
	</Directory>
	<Directory /var/www/lab>
		Order Allow,Deny
		Allow from all
	</Directory>

# Alias for project independent contents
	<Location /static>
		Order Allow,Deny
		Allow from all
	</Location>
	Alias /static/trac	/var/www/trac
	Alias /static/svn	/home/tools/www/svn
	Alias /static/htdocs	/home/tools/trac/htdocs

# Alias for SVN
        RedirectMatch ^/svn$ /svn/
	<Location /svn/>
		# Requests for a collection must have a trailing slash on the URI.
		DAV svn
		SVNParentPath /var/svn/lab
		SVNListParentPath on
		SVNIndexXSLT "/static/svn/svnindex.xsl"
		<LimitExcept GET PROPFIND OPTIONS REPORT>
			Order Allow,Deny
			Deny from all
		</LimitExcept>
		Order Allow,Deny
		Allow from all
	</Location>

# Alias for Trac
	ScriptAlias /trac	/home/tools/trac/cgi-bin/trac.fcgi
	FcgidInitialEnv PYTHON_EGG_CACHE "/tmp"
	FcgidInitialEnv TRAC_ENV_PARENT_DIR "/var/trac/lab"

	# increase fcgi timeout value to wait slow cgi exec
	FcgidIOTimeout 180

	<Location /trac>
		<LimitExcept GET>
			Order Allow,Deny
			Deny from all
		</LimitExcept>
		Order Allow,Deny
		Allow from all
	</Location>
	<LocationMatch /trac/[^/]+/login>
		Deny from all
	</LocationMatch>

## Trac query redirect
	RewriteEngine On
	RewriteCond %{QUERY_STRING} ^$
	RewriteCond %{REQUEST_METHOD} !POST
	RewriteCond %{HTTP_COOKIE} !trac_auth=
	RewriteRule ^/trac/([^/]+)/query$ /trac/$1/query?status=!&group=component [R,L]

</VirtualHost>
