一、先学习apache2的安装和配置;
二、安装和配置Twiki
安装环境:虚拟机ubuntu 10.04 (Linux ubuntu 2.6.32-25-generic #45-Ubuntu SMP i686 GNU/Linux)
1. 把twiki作为apache2的默认配置,将twiki解压后放在/var/www/下,创建并修改相关文件(在twiki下都有副本,可以直接拷贝,稍加改动即可用),需要修改的文件:
bin/LocalLib.cfg (bin/LocalLib.cfg.txt)
lib/LocalSite.cfg (lib/LocalSite.cfg.txt)
# cgi-bin URL path for TWiki e.g. /twiki/bin
$cfg{ScriptUrlPath} = '/twiki/bin';
# Attachments URL path e.g. /twiki/pub
$cfg{PubUrlPath} = '/twiki/pub';
# Attachments store file path (not URL), must match /twiki/pub e.g.
# /usr/local/twiki/pub
$cfg{PubDir} = '/var/www/twiki/pub';
# SECURITY NOTE: Directories =twiki/data= , =twiki/templates= and all their
# subdirectories should be set so that they are _not_ visible through
# URLs. (Alternatively, move the directories to a place where they are
# not visible, and set the paths here as appropriate)
# Template directory e.g. /usr/local/twiki/templates
$cfg{TemplateDir} = '/var/www/twiki/templates';
# Topic files store (file path not URL) e.g. /usr/local/twiki/data
# TWiki will use this path to base other defaults, such as the location
# of password files.
$cfg{DataDir} = '/var/www/twiki/data';
httpd.conf (twiki_httpd_conf.txt),修改之后将内容附加到/etc/apache2/httpd.conf文件
# 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/"
# 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
<Directory "/var/www/twiki/bin">
Options +ExecCGI FollowSymLinks
SetHandler cgi-script
Allow from all
</Directory>
#<Directory "/var/www/twiki/bin">
# AllowOverride None
# Options None
# Order allow,deny
# Allow from all
#</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.
# 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 FollowSymLinks +Includes
Allowoverride All
Allow from all
</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>
index.html (修改index文件中的超链接是为了与httpd.conf中的ScriptAlias /twiki/bin/ "/var/www/twiki/bin/"保持一致)
2. 在浏览器中输入http://localhost/,可以浏览twiki的首页,点击Configure TWiki,进入配置界面
三、配置当中遇到的问题
在http.conf中,
ScriptAlias /twiki/bin/ "/var/www/twiki/bin/"
/twiki/bin是相对于/localhost/来讲的
也就是说在不修改上述index.html的情况下,需要输入http://localhost/twiki/bin/configure 才可以执行配置
参考资料:http://man.chinaunix.net/newsoft/ApacheMenual_CN_2.2new/index.html