# $Id: xeno.conf,v 1.12 2007-12-13 12:32:48 mike Exp $

# This is an Apache 1.3 configuration file, to be dropped into the
# conf.d directory of a mod_perl-enabled server.  The exact location
# of the conf.d directory will be different depending on your
# operating system, but --
#
# On Red Hat 9 and probably all Red Hat-based Linuxes it's:
#	/etc/httpd/conf.d
# On Ubuntu 6.06 and probably all Debian-based Linuxes it's:
#	/etc/apache/conf.d/
#
# So, for example, on a Ubuntu 6.06 system:
#	cd /etc/apache/conf.d
#	sudo ln -s /usr/local/src/cvs/openurl-resolver/web/conf/apache1.3/xeno.conf resolver.conf
#	sudo ln -s /usr/local/src/cvs/openurl-resolver/web/conf/apache1.3/xeno.conf resolver.conf
#	sudo apachectl restart
#
# This file does not need to be owned by root, so long as it's placed
# in the root-owned configuration directory.

<VirtualHost 127.0.0.1 192.168.1.75>
    ServerName x.resolver.indexdata.com
    ServerAlias x.dbc.resolver.indexdata.com
    ServerAlias x.talis.resolver.indexdata.com

    DocumentRoot    /usr/local/src/cvs/openurl-resolver/web/htdocs
    ErrorLog        /var/log/apache/keystone-resolver-error.log
    CustomLog       /var/log/apache/keystone-resolver-access.log combined

    PerlSetEnv PERL5LIB /usr/local/src/cvs/openurl-resolver/lib
    PerlSetEnv KRxsltdir /usr/local/src/cvs/openurl-resolver/etc/xslt
    PerlSetEnv KRdbms mysql

    # I would prefer to put the rewrite rules inside a <Location>, but
    # empirically this does not work -- the rules are simply ignored.
    # *Sigh*  Why does _nothing_ under Apache work properly, out of
    # the box, the way it's supposed to?
    RewriteEngine on
    RewriteLog /var/log/apache/keystone-resolver-rewrite.log
    RewriteLogLevel 1
    RewriteRule ^/(index.html|resolve|cookiepusherpusher)?$ /mod_perl/$1
    RewriteRule ^/mod_perl/resolve/(.+) /mod_perl/resolve?opt_db=$1

    # ... and I would prefer to use <Location /mod_perl> rather than
    # spell out the whole directory name, but predictably that also
    # does not work.  *Sigh*
    <Directory /usr/local/src/cvs/openurl-resolver/web/htdocs/mod_perl>
	Options +ExecCGI
	SetHandler perl-script
	PerlHandler Apache::Registry
	# I don't understand why I need the next line, but I do
	PerlSendHeader On

	PerlSetEnv KRuser kr_read
	PerlSetEnv KRpw kr_read_3636
    </Directory>

    # Admin interface uses HTML::Mason
    <Directory /usr/local/src/cvs/openurl-resolver/web/htdocs/admin>
	<FilesMatch "\.(html|css)$">
	    SetHandler perl-script
	    PerlHandler HTML::Mason::ApacheHandler
	</FilesMatch>
	PerlAddVar MasonCompRoot "private => /usr/local/src/cvs/openurl-resolver/web/htdocs/admin"
	PerlSetVar MasonDataDir /var/cache/kr-local-webui/mason

	PerlSetEnv KRrwuser kr_admin
	PerlSetEnv KRrwpw kr_adm_3636
    </Directory>
</VirtualHost>
