我的网络服务器上运行了几个webapp:
https://beta.mydomain.tld/svn/repos
https://beta.mydomain.tld/trac
http://beta.mydomain.tld/
访问,使用端口8080上本地Apache Tomcat的代理请注意,前两个是通过SSL提供的,第三个不是(尚未)。现在我需要通过https提供我的网络应用程序,但我希望仍然可以在当前位置访问Trac和SVN浏览器。
即。我正在尝试将apache2配置为将所有不以svn
或trac
开头的请求代理到Tomcat。
对于现有的SSL网络应用,有以下配置
<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>
答案 0 :(得分:13)
刚放下ProxyPass!进入这两个位置块。这会停止代理相关地点。
答案 1 :(得分:3)
我有相同的场景(在Windows上)。对于任何挣扎于此的人:
当我在 Proxy *指令之前移动“svn location”部分时,它才开始为我工作。
<VirtualHost *:443>
ServerName www.domain.com
DocumentRoot "C:/Apache/domain"
ServerAdmin admin@domain.com
SSLEngine On
SSLCertificateFile "conf/ssl/domain.crt"
SSLCertificateKeyFile "conf/ssl/domain.key"
SSLCertificateChainFile "conf/ssl/domain.ca-bundle.crt"
<Location /svn>
DAV svn
SVNPath "C:/svnrepo"
SSLRequireSSL
AuthName "www.domain.com"
AuthType Basic
AuthUserFile "conf/svn/users"
AuthGroupFile "conf/svn/groups"
Require valid-user
# needs to come before the ProxyPass directives
ProxyPass !
</Location>
ProxyRequests off
ProxyPreserveHost on
ProxyPass / ajp://127.0.0.1:8080/
ProxyPassReverse / ajp://127.0.0.1:8080/
</VirtualHost>