【发布时间】:2012-05-07 00:08:35
【问题描述】:
我的网络服务器上运行了几个网络应用程序:
- SVN 存储库浏览器,可通过
https://beta.mydomain.tld/svn/repos访问 - Trac 实例,可通过
https://beta.mydomain.tld/trac访问 - 我自己的 Java Web 应用程序,可通过
http://beta.mydomain.tld/访问,使用端口 8080 上的本地 Apache Tomcat 代理
请注意,前两个可通过 SSL 获得,第三个(目前)尚不可用。现在我需要通过 https 使我的网络应用程序可用,但我希望 Trac 和 SVN 浏览器仍然可以在其当前位置访问。
即我正在尝试将 apache2 配置为将所有不以 svn 或 trac 开头的请求代理到 Tomcat。
对于现有的 SSL web 应用程序,有以下配置
<Location /svn/repos>
DAV svn
SVNParentPath /home/myuser/svn
SVNListParentPath on
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /home/myuser/.htpasswd
Require valid-user
</Location>
<Location /trac>
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /home/myuser/trac
PythonOption TracUriRoot /trac
AuthType Basic
AuthName "Trac"
AuthUserFile /home/myuser/.htpasswd
Require valid-user
</Location>
我尝试添加以下位置,但没有任何帮助...
<Location />
ProxyPass http://localhost:8080
ProxyPassReverse http://localhost:8080/
</Location>
有关更多信息,这里是关于 SSL 部分的完整 apache2 配置(其中没有我的任何失败试验 - 我认为这是默认的 trac 配置):
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName beta.mydomain.tld:443
DocumentRoot /var/www/
<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/ssl_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>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl.crt
SSLCertificateKeyFile /etc/ssl/private/ssl.key
BrowserMatch ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
<Location /svn/repos>
DAV svn
SVNParentPath /home/myuser/svn
SVNListParentPath on
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /home/myuser/.htpasswd
Require valid-user
</Location>
<Location /trac>
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /home/myuser/trac
PythonOption TracUriRoot /trac
AuthType Basic
AuthName "Trac"
AuthUserFile /home/myuser/.htpasswd
Require valid-user
</Location>
【问题讨论】:
标签: apache2 virtualhost mod-proxy