The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#
# Based upon the NCSA server configuration files originally by Rob McCool.
#
### Section 1: Global Environment

ServerRoot "/usr/local/test/httpd"

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
#
PidFile /usr/local/test/var/run/httpd.pid

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 25

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15

##
## Server-Pool Size Regulation (MPM specific)
## 

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
StartServers         2
MaxClients         150
MinSpareThreads     25
MaxSpareThreads     75 
ThreadsPerChild     25
MaxRequestsPerChild  0

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the <VirtualHost>
# directive.
#

#
# Dynamic Shared Object (DSO) Support
#
LoadModule auth_digest_module /usr/apache2/lib/apache/mod_auth_digest.so
LoadModule dav_module /usr/apache2/lib/apache/mod_dav.so
LoadModule dav_fs_module /usr/apache2/lib/apache/mod_dav_fs.so
LoadModule deflate_module /usr/apache2/lib/apache/mod_deflate.so
LoadModule rewrite_module /usr/apache2/lib/apache/mod_rewrite.so
LoadModule speling_module /usr/apache2/lib/apache/mod_speling.so

### Section 2: 'Main' server configuration
#

#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.  
#
User wwwrun
Group nogroup

#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.
#
ServerAdmin webmaster@beaucox.com

#
# UseCanonicalName: Determines how Apache constructs self-referencing 
# URLs and the SERVER_NAME and SERVER_PORT variables.
#
UseCanonicalName Off

#
# DocumentRoot: The directory out of which you will serve your documents.
#
DocumentRoot "/usr/local/test/httpd/htdocs"

#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories). 
#
<Directory />
    Options +FollowSymLinks -Indexes
    AllowOverride None
</Directory>

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/usr/local/test/httpd/htdocs">
    Options +FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#
UserDir public_html

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
DirectoryIndex index.htm index.html index.html.var

#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride 
# directive.
#
AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being 
# viewed by Web clients. 
#
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

#
# TypesConfig describes where the mime.types file (or equivalent) is
# to be found.
#
TypesConfig /etc/httpd/mime.types

#
# DefaultType is the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
#
DefaultType text/plain

#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type.  The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
<IfModule mod_mime_magic.c>
    MIMEMagicFile /etc/httpd/magic
</IfModule>

#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
#
HostnameLookups Off

#
# ErrorLog: The location of the error log file.
#
ErrorLog /usr/local/test/var/log/httpd/error_log

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here.
#
CustomLog /usr/local/test/var/log/httpd/access_log common

#
# ServerTokens
# This directive configures what you return as the Server HTTP response
# Header.
#
ServerTokens Full

#
# Optionally add a line containing the server version and virtual host
# name to server-generated pages (internal error documents, FTP directory 
# listings, mod_status and mod_info output etc., but not CGI generated 
# documents or custom error documents).
# Set to "EMail" to also include a mailto: link to the ServerAdmin.
# Set to one of:  On | Off | EMail
#
ServerSignature On

#
# Aliases: Add here as many aliases as you need (with no limit). The format is 
# Alias fakename realname
#
Alias /icons/ "/usr/local/test/httpd/icons/"

<Directory "/usr/local/test/httpd/icons">
    Options MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

#
# This should be changed to the ServerRoot/manual/.
#
Alias /manual "/usr/local/test/httpd/manual"

<Directory "/usr/local/test/manual">
    Options FollowSymLinks MultiViews IncludesNoExec
    AddOutputFilter Includes html
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

#
# ScriptAlias: This controls which directories contain server scripts.
#
ScriptAlias /cgi-bin/ "/usr/local/test/httpd/cgi-bin/"

<IfModule mod_cgid.c>
#
# Additional to mod_cgid.c settings, mod_cgid has Scriptsock <path>
# for setting UNIX socket for communicating with cgid.
#
Scriptsock            /usr/local/test/var/run/cgisock
</IfModule>

#
# "/srv/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/usr/local/test/httpd/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

#
# IndexIgnore is a set of filenames which directory indexing should ignore
# and not include in the listing.  Shell-style wildcarding is permitted.
#
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t

#
# AddEncoding allows you to have certain browsers (Mosaic/X 2.1+) uncompress
# information on the fly. Note: Not all browsers support this.
# Despite the name similarity, the following Add* directives have nothing
# to do with the FancyIndexing customization directives above.
#
AddEncoding x-compress Z
AddEncoding x-gzip gz tgz

#
# DefaultLanguage and AddLanguage allows you to specify the language of 
# a document.
#
AddLanguage da .dk
AddLanguage nl .nl
AddLanguage en .en
AddLanguage et .et
AddLanguage fr .fr
AddLanguage de .de
AddLanguage he .he
AddLanguage el .el
AddLanguage it .it
AddLanguage ja .ja
AddLanguage pl .po
AddLanguage ko .ko
AddLanguage pt .pt
AddLanguage nn .nn
AddLanguage no .no
AddLanguage pt-br .pt-br
AddLanguage ltz .ltz
AddLanguage ca .ca
AddLanguage es .es
AddLanguage sv .se
AddLanguage cz .cz
AddLanguage ru .ru
AddLanguage tw .tw
AddLanguage zh-tw .tw
AddLanguage hr .hr

#
# LanguagePriority allows you to give precedence to some languages
# in case of a tie during content negotiation.
#
LanguagePriority en da nl et fr de el it ja ko no pl pt pt-br ltz ca es sv tw

#
# ForceLanguagePriority allows you to serve a result page rather than
# MULTIPLE CHOICES (Prefer) [in case of a tie] or NOT ACCEPTABLE (Fallback)
# [in case no accepted languages matched the available variants]
#
ForceLanguagePriority Prefer Fallback

#
# Specify a default charset for all pages sent out. This is
# always a good idea and opens the door for future internationalisation
# of your web site, should you ever want it.
#
AddDefaultCharset ISO-8859-1

#
# Commonly used filename extensions to character sets. You probably
# want to avoid clashes with the language extensions, unless you
# are good at carefully testing your setup after each change.
#
AddCharset ISO-8859-1  .iso8859-1  .latin1
AddCharset ISO-8859-2  .iso8859-2  .latin2 .cen
AddCharset ISO-8859-3  .iso8859-3  .latin3
AddCharset ISO-8859-4  .iso8859-4  .latin4
AddCharset ISO-8859-5  .iso8859-5  .latin5 .cyr .iso-ru
AddCharset ISO-8859-6  .iso8859-6  .latin6 .arb
AddCharset ISO-8859-7  .iso8859-7  .latin7 .grk
AddCharset ISO-8859-8  .iso8859-8  .latin8 .heb
AddCharset ISO-8859-9  .iso8859-9  .latin9 .trk
AddCharset ISO-2022-JP .iso2022-jp .jis
AddCharset ISO-2022-KR .iso2022-kr .kis
AddCharset ISO-2022-CN .iso2022-cn .cis
AddCharset Big5        .Big5       .big5
# For russian, more than one charset is used (depends on client, mostly):
AddCharset WINDOWS-1251 .cp-1251   .win-1251
AddCharset CP866       .cp866
AddCharset KOI8-r      .koi8-r .koi8-ru
AddCharset KOI8-ru     .koi8-uk .ua
AddCharset ISO-10646-UCS-2 .ucs2
AddCharset ISO-10646-UCS-4 .ucs4
AddCharset UTF-8       .utf8

# The set below does not map to a specific (iso) standard
# but works on a fairly wide range of browsers. Note that
# capitalization actually matters (it should not, but it
# does for some browsers).
#
AddCharset GB2312      .gb2312 .gb 
AddCharset utf-7       .utf7
AddCharset utf-8       .utf8
AddCharset big5        .big5 .b5
AddCharset EUC-TW      .euc-tw
AddCharset EUC-JP      .euc-jp
AddCharset EUC-KR      .euc-kr
AddCharset shift_jis   .sjis

#
# AddType allows you to add to or override the MIME configuration
# file mime.types for specific file types.
#
AddType application/x-tar .tgz
AddType image/x-icon .ico

#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
AddHandler type-map var

#
# The following directives modify normal HTTP response behavior to
# handle known problems with browser implementations.
#
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0

#
# The following directive disables redirects on non-GET requests for
# a directory that does not include the trailing slash.  This fixes a 
# problem with Microsoft WebFolders which does not appropriately handle 
# redirects for folders with DAV methods.
# Same deal with Apple's DAV filesystem.
#
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully

#
# Allow server status reports generated by mod_status.
#
<IfModule mod_status.c>
	ExtendedStatus On
	<Location /server-status>
		SetHandler server-status
	</Location> 
</IfModule>

### Global SSL

AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl    .crl

SSLPassPhraseDialog  builtin
SSLSessionCache         dbm:/usr/local/test/var/log/httpd/ssl_scache
SSLSessionCacheTimeout  300
SSLMutex  file:/usr/local/test/var/log/httpd/ssl_mutex
SSLRandomSeed startup file:/dev/urandom 512
SSLRandomSeed connect file:/dev/urandom 512

### Section 3: mod_perl and mason

#-------------------mod_perl---------------------------------
LoadModule perl_module /usr/apache2/lib/apache/mod_perl.so
LoadModule apreq_module /usr/apache2/lib/apache/mod_apreq.so
LoadModule cgid_module /usr/apache2/lib/apache/mod_cgid.so

PerlSetEnv MOD_PERL_INC	"/usr/local/test/httpd/perl"
PerlRequire "/usr/local/test/httpd/conf/startup2.pl"

Alias /perl/ /usr/local/test/httpd/perl/
<Location /perl/>
  SetHandler perl-script
  PerlResponseHandler ModPerl::Registry
  PerlOptions +ParseHeaders
  Options +ExecCGI
</Location>

PerlTransHandler +MyApache::Redirect
PerlSetVar Redirect		verbose
PerlAddVar Redirect		0
PerlSetVar RedirectPort		"^test-"
PerlAddVar RedirectPort		12984

PerlModule MyApache::HappyFunBall
<Location /happyfunball>
  SetHandler modperl
  PerlResponseHandler MyApache::HappyFunBall
</Location>

PerlModule MyApache::Dump
<Location /get>
  SetHandler modperl
  PerlResponseHandler MyApache::Dump
</Location>
<Location /post>
  SetHandler modperl
  PerlResponseHandler MyApache::Dump
</Location>

#-------------------mason------------------------------------

PerlSetVar _MasonUser wwwrun
PerlSetVar _MasonGroup nogroup
PerlSetVar _MasonDefaultDocumentRoot "/usr/local/test/httpd/htdocs"

PerlSetVar BC_MasonLint 5

PerlSetEnv MASON_COMP_ROOT	"/usr/local/test/httpd/htdocs"
PerlSetEnv MASON_DATA_ROOT	"/usr/local/test/httpd/mason"
PerlSetEnv MASON_SITES		"bctest:masontest"

### Section 4: Virtual Hosts

Listen 12984
NameVirtualHost localhost:12984

# for general testing - default - on localhost

<VirtualHost localhost:12984>
  ServerName bctest.beaucox.com
  DocumentRoot "/usr/local/test/httpd/htdocs/bctest"
  PerlSetVar mason_site 'bctest'
  <FilesMatch "^_">
    SetHandler perl-script
    PerlResponseHandler MyApache::Mason::ApacheHandler2
  </FilesMatch>
  <Directory "/usr/local/test/httpd/htdocs/bctest">
    <FilesMatch "\.html$|\.htm$">
      SetHandler perl-script
      PerlResponseHandler MyApache::Mason::ApacheHandler2
    </FilesMatch>
  </Directory>
</VirtualHost>

<VirtualHost localhost:12984>
  ServerName masontest.beaucox.com
  DocumentRoot "/usr/local/test/httpd/htdocs/masontest"
  PerlSetVar mason_site 'masontest'
  <FilesMatch "^_">
    SetHandler perl-script
    PerlResponseHandler MyApache::Mason::ApacheHandler2
  </FilesMatch>
  <Directory "/usr/local/test/httpd/htdocs/masontest">
    <FilesMatch "\.html$|\.htm$">
      SetHandler perl-script
      PerlResponseHandler MyApache::Mason::ApacheHandler2
    </FilesMatch>
  </Directory>
</VirtualHost>