Tech:Sample Apache Config
From Cyclopath
The following is a sample Apache config file; put it in sites-available/cyclopath and then say a2ensite cyclopath.
Search and replace on $CPROOT, substituting the path to your Cyclopath working directory.
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin reid@localhost
# Don't forget to also set PythonPath below.
DocumentRoot $CPROOT/cp/htdocs
# By default, serve nothing
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
# Don't serve .svn directories
<DirectoryMatch "\.svn/">
Deny from all
</DirectoryMatch>
# DocumentRoot
<Directory $CPROOT/cp/htdocs>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
# Default caching policy: caches can go 1 hour between re-validations
Header set Cache-Control "max-age=3600, must-revalidate"
</Directory>
# Home page (http://cyclopath.org/)
Alias /home/ $CPROOT/cp/mediawiki/home/
<Directory $CPROOT/cp/mediawiki/home>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
# MapServer
Alias /wms $CPROOT/mapserver/mapserv
<Location /wms>
Order allow,deny
Allow from localhost
SetHandler cgi-script
Options +ExecCGI
SetEnv MS_MAPFILE $CPROOT/cp/mapserver/wms.map
</Location>
# TileCache via mod_python
<Location /tilec>
Order allow,deny
Allow from all
SetHandler mod_python
PythonHandler TileCache.Service
PythonPath "['$CPROOT/tilecache'] + sys.path"
PythonOption TileCacheConfig $CPROOT/tilecache/tilecache.cfg
</Location>
# Try to fix browsers re-loading stale versions of main.swf: allow only
# one second before re-validating.
<Location /main.swf>
Header set Cache-Control "max-age=1, must-revalidate"
</Location>
# WFS Pyserver via mod_python
<Location /wfs>
Order allow,deny
Allow from all
# No caching directives for the pyserver
Header unset Cache-Control
SetOutputFilter DEFLATE
SetHandler mod_python
PythonDebug On
PythonPath "['$CPROOT/cp/pyserver'] + sys.path"
PythonHandler wfs_mod_python
</Location>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %{ptime}e" combinedplus
CustomLog /var/log/apache2/access.log combinedplus
ServerSignature On
</VirtualHost>
[edit] Headers Module
Note: For the <Headers> directive to work, you'll need to enable the headers module. E.g.,
cd /etc/apache2/mods-enabled/ ln -s ../mods-available/headers.load headers.load
