Example httpd.conf file for TWiki.
#
# You are recommended to take a copy of this file and edit
# the paths to match your installation. Then add:
# include "/home/httpd/twiki/twiki_httpd.conf"
# to the end of your main httpd.conf file.
#
# The first parameter will be part of the URL to your installation e.g.
# http://my.co.uk/twiki/bin/view/...
# The second parameter must point to the physical path on your disk. Be
# careful not to lose any trailing /'s.
#### Change the _second_ path to match your local installation
ScriptAlias /twiki/bin/ "/var/www/twiki/bin/"
# This defines a url that points to the root of the twiki installation. It is
# used to access files in the pub directory (attachments etc)
# It must come _after_ the ScriptAlias.
#### Change the path to match your local installation
Alias /twiki/ "/var/www/twiki/"
# We set an environment variable called anonymous_spider
# Setting a BrowserMatchNoCase to ^$ is important. It prevents TWiki from
# including its own topics as URLs and also prevents other TWikis from
# doing the same. This is important to prevent the most obvious
# Denial of Service attacks.
# You can expand this by adding more BrowserMatchNoCase statements to
# block evil browser agents trying the impossible task of mirroring a twiki
# Example:
# BrowserMatchNoCase ^SiteSucker anonymous_spider
BrowserMatchNoCase ^$ anonymous_spider
# This specifies the options on the TWiki scripts directory. The ExecCGI
# and SetHandler tell apache that it contains scripts. "Allow from all"
# lets any IP address access this URL.
#### Change the path to match your local installation
#Alias /perl /var/www/perl
#<Directory /var/www/perl>
# SetHandler perl-script
# PerlResponseHandler ModPerl::Registry
# PerlOptions +ParseHeaders
# Options +ExecCGI
#</Directory>
<Directory "/var/www/twiki/bin">
Options +ExecCGI FollowSymLinks
SetHandler perl-script
PerlOptions +ParseHeaders
# Order Allow,Deny
# Allow from all
Deny from env=anonymous_spider
# AuthType Basic
# AuthName "Twiki Knowledge System"
# AuthUserFile /var/www/twiki/data/htpasswd
# Require valid-user
Options +ExecCGI
</Directory>
# This sets the options on the pub directory, which contains attachments and
# other files like CSS stylesheets and icons. AllowOverride None stops a
# user installing a .htaccess file that overrides these options.
# Finally all execution of PHP and other scripts is disabled.
# Note that files in pub are *not* protected by TWiki Access Controls,
# so if you want to control access to files attached to topics, you may
# need to add your own .htaccess files to subdirectories of pub. See the
# Apache documentation on .htaccess for more info.
#### Change the path to match your local installation
<Directory "/var/www/twiki/pub">
Options None
AllowOverride None
Allow from all
# If you have PHP4 or PHP5 installed make sure the directive below is enabled
# If you do not have PHP installed you will need to comment out the directory below
# to avoid errors.
# php_admin_flag engine off
#If you have PHP3 installed make sure the directive below is enabled
#php3_engine off
# This line will redefine the mime type for the most common types of scripts
# It will also deliver HTML files as if they are text files
AddType text/plain .html .htm .shtml .php .php3 .phtml .phtm .pl .py .cgi
</Directory>
# Security note: All other directories should be set so
# that they are *not* visible as URLs, so we set them as =deny from all=.
#### Change the paths to match your local installation
<Directory "/var/www/twiki/data">
deny from all
</Directory>
<Directory "/var/www/twiki/templates">
deny from all
</Directory>
<Directory "/var/www/twiki/lib">
deny from all
</Directory>
<Directory "/var/www/twiki/tools">
deny from all
</Directory>
<Directory "/var/www/twiki/locale">
deny from all
</Directory>