##
## Palm Digital Media Store Mason mod_perl server
##

##
## Server setup
##

ServerType standalone

ServerName shawn.test.ereader.com
Port 81

BindAddress 10.35.38.230

HostnameLookups off

User web
Group web

ServerAdmin support@ereader.com

ServerRoot   /www/pdm/apache/store/mason
DocumentRoot /www/pdm/apache/store/htdocs

##
## Access control
##

# Only allow access form the proxy server
<Directory />
  Order Deny,Allow
  Deny from all
  Allow from 127.0.0.1 10.35.38.230 10.35.38.231
  AllowOverride None
  Options FollowSymLinks -Indexes -Includes
</Directory>

##
## Logging
##

PidFile logs/httpd.pid

LogFormat "%V %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhostcombined

ErrorLog  /www/pdm/apache/store/mason/logs/error_log
CustomLog /www/pdm/apache/store/mason/logs/access_log vhostcombined

ScoreBoardFile logs/apache_status

##
## File types
##

TypesConfig conf/mime.types

##
## Processes
##

Timeout 400

KeepAlive Off

MinSpareServers     1
MaxSpareServers     2
StartServers        2
MaxClients          100
MaxRequestsPerChild 1000

##
## Lock file
##

#LockFile logs/accept.lock

##
## Apache 1.3.24 chunked encoding bug work-around
##

# See: http://marc.theaimsgroup.com/?l=apache-modperl&m=101805295408540&w=2
# I've chosen to single-out Netscape 4.x rather than downgrade every browser.
#<IfModule mod_setenvif.c>
#  BrowserMatch "Mozilla/4." downgrade-1.0 force-response-1.0
#</IfModule>

##
## Type mapping, etc.
##

#UserDir disabled
DirectoryIndex index.html

DefaultType text/html

AddEncoding x-compress Z
AddEncoding x-gzip gz

##
## Error documents
##

ErrorDocument 404 /errors/404.html
ErrorDocument 500 /errors/500.html
#ErrorDocument 500 http://promo.ereader.com/errors/500.html

##
## Default store id
##

PerlPassEnv STORE_ID
PerlSetEnv  STORE_ID "pdm"

##
## Perl configuration
##

#
# Interactive debugging
#

<IfDefine PERLDB>

<Perl>
  use Apache::DB();
  Apache::DB->init;
</Perl>
  
<Location />
  PerlFixupHandler Apache::DB
</Location>

</IfDefine>

#
# Custom configuration
#

<IfDefine DEVELOPMENT>
# Boolean to turn on fake authentication
PerlSetVar PDMFakeAuth 0
</IfDefine>

PerlSetVar PDMUserClass "PDM::Store::User"

#
# Basic setup
#

<IfDefine DEVELOPMENT>
SetEnv MOD_PERL_TRACE "all"

# reload changed .pm files
#PerlInitHandler Apache::Reload
PerlSetVar MasonUseObjectFiles 0

#PerlFreshRestart On
</IfDefine>

#
# Mason
#

PerlSetVar MasonDefaultEscapeFlags "n"
#PerlAddVar  MasonDataCacheDefaults "cache_class => MemoryCache" 

PerlSetVar MasonErrorMode "output"

#
# Perl startup
#

# PerlModule Apache::Status
# PerlModule B::TerseSize
#
# PerlSetVar StatusOptionsAll On
# PerlSetVar StatusTerse On
# PerlSetVar StatusTerseSize On
# PerlSetVar StatusTerseSizeMainSummary On

PerlRequire conf/startup.pl

#
# Perl handlers
#

<IfDefine DEVELOPMENT>
PerlInitHandler +Apache::StatINC
</IfDefine>

PerlInitHandler  PDM::Store::Apache::Init
PerlTransHandler PDM::Store::Apache::Trans
PerlFixupHandler Apache::SizeLimit

<Location />
  SetHandler perl-script
  PerlHandler PDM::Store::Apache::Handler

  AuthName Store
  AuthType Basic
  PerlAuthenHandler PDM::WebSite::Apache::Auth
  PerlAuthzHandler  PDM::WebSite::Apache::Authz
  require valid-user
</Location>

#
# Applicaton configuration
#

<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
</IfModule>

Include conf/application.conf
