我有一个安装了 trac(错误跟踪系统)的 debian lenny 服务器,它使用 apache,我想添加另一个名为 rt(请求跟踪器)的工具。一切都正常,只是我无法同时加载它们。我在虚拟主机上尝试的任何操作最终都只能使其中一个工作。
这是对我有用的 rt 虚拟主机:
<VirtualHost *:80>
ServerName todasana.fondoavila.com
DocumentRoot /opt/rt3/share/html
PerlRequire "/opt/rt3/bin/webmux.pl"
<Location /rt>
AddDefaultCharset UTF-8
SetHandler perl-script
PerlResponseHandler RT::Mason
</Location>
</VirtualHost>
这是我安装 trac 的默认虚拟主机
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
TRAC 根:http://服务器/trac或者http://服务器/trac/
# Rewrite ./trac to ./trac/
RewriteEngine on
RewriteRule ^(.*)\/trac$ $1/ [NC]
<Location /trac/>
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonInterpreter main
PythonOption TracEnvParentDir /var/trac/env
PythonOption TracUriRoot /trac
SetEnv PYTHON_EGG_CACHE /tmp
</Location>
### TRAC Login : http://server/trac/*/login
<LocationMatch ^(/trac/[^/]+)?/login>
AuthType Basic
AuthName "TRAC Login"
AuthUserFile /etc/apache2/passwd-trac
Require valid-user
</LocationMatch>
### SVN repository : http://server/svn
<Location /svn>
DAV svn
SVNParentPath /var/svn-repos/catwizard3
SVNListParentPath on
AuthType Basic
AuthName "SVN Repository"
AuthUserFile /etc/apache2/passwd-trac
Require valid-user
</Location>
任何解决方案都将不胜感激!谢谢!
答案1
#order matters
#DNS or your hosts file must be set correctly
<VirtualHost *:80>
ServerName trac.fondoavila.com
#all trac config here
</VirtualHost>
<VirtualHost *:80>
ServerName todasana.fondoavila.com
#all rt config here
</VirtualHost>
使用此设置,如果您转到,todasana.fondoavila.com
将返回 rt 内容。如果您转到trac.fondavila.com
(或指向此框的其他主机名或 IP),您将获得 trac 内容。ServerName
这是决定如何处理请求的东西。
此外,如果未被覆盖,部分之外的任何内容VirtualHost
都将被应用,因此请确保您没有任何重写规则或任何可能会造成混乱的其他内容。