如何为所有路径(apache2中的部分路径除外)设置代理位置?

如何为所有路径(apache2中的部分路径除外)设置代理位置?,apache2,virtualhost,mod-proxy,Apache2,Virtualhost,Mod Proxy,我的Web服务器上运行了多个Web应用程序: SVN存储库浏览器,可通过https://beta.mydomain.tld/svn/repos Trac实例,可通过https://beta.mydomain.tld/trac 我自己的java web应用程序,可通过http://beta.mydomain.tld/,在端口8080上使用本地Apache Tomcat的代理 请注意,前两个是通过SSL提供的,第三个还没有。现在我需要通过https提供我的web应用程序,但我希望Trac和SVN

我的Web服务器上运行了多个Web应用程序:

  • SVN存储库浏览器,可通过
    https://beta.mydomain.tld/svn/repos
  • Trac实例,可通过
    https://beta.mydomain.tld/trac
  • 我自己的java web应用程序,可通过
    http://beta.mydomain.tld/
    ,在端口8080上使用本地Apache Tomcat的代理
请注意,前两个是通过SSL提供的,第三个还没有。现在我需要通过https提供我的web应用程序,但我希望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>

DAV svn
SVNParentPath/home/myuser/svn
SVNListParentPath打开
AuthType Basic
AuthName“Subversion存储库”
AuthUserFile/home/myuser/.htpasswd
需要有效用户
SetHandler mod_python
PythonHandler trac.web.modpython_前端
PythonOption tracevenparentdir/home/myuser/trac
粗根蟒蛇
AuthType Basic
AuthName“Trac”
AuthUserFile/home/myuser/.htpasswd
需要有效用户
我试图添加以下位置,但没有任何帮助

    <Location />
        ProxyPass           http://localhost:8080
        ProxyPassReverse    http://localhost:8080/
    </Location>

ProxyPasshttp://localhost:8080
ProxyPassReversehttp://localhost:8080/
关于进一步的信息,这里是关于SSL部分的完整apache2配置(其中没有任何失败的测试-我认为这是默认的trac配置):


服务器管理员webmaster@localhost
ServerName beta.mydomain.tld:443
DocumentRoot/var/www/
选项索引跟随符号链接多视图
不允许超限
命令允许,拒绝
通融
ScriptAlias/cgi-bin//usr/lib/cgi-bin/
不允许超限
选项+执行CGI-多视图+符号链接所有者匹配
命令允许,拒绝
通融
ErrorLog/var/log/apache2/error.log
#可能的值包括:调试、信息、通知、警告、错误、临界值、,
#警惕,埃默格。
日志级别警告
CustomLog/var/log/apache2/ssl\u access.log组合
别名/doc/“/usr/share/doc/”
选项索引多视图跟随符号链接
不允许超限
命令拒绝,允许
全盘否定
允许从127.0.0.0/255.0.0.0::1/128开始
斯伦金安
SSLCertificateFile/etc/ssl/certs/ssl.crt
SSLCertificateKeyFile/etc/ssl/private/ssl.key
浏览器匹配“*MSIE.*”\
nokeepalive ssl不干净关闭\
降级-1.0力响应-1.0
DAV svn
SVNParentPath/home/myuser/svn
SVNListParentPath打开
AuthType Basic
AuthName“Subversion存储库”
AuthUserFile/home/myuser/.htpasswd
需要有效用户
SetHandler mod_python
PythonHandler trac.web.modpython_前端
PythonOption tracevenparentdir/home/myuser/trac
粗根蟒蛇
AuthType Basic
AuthName“Trac”
AuthUserFile/home/myuser/.htpasswd
需要有效用户

把ProxyPass放进去!进入这两个位置块。这将停止代理相关位置。

我有相同的场景(在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>

服务器名www.domain.com
DocumentRoot“C:/Apache/domain”
服务器管理员admin@domain.com
斯伦金安
SSLCertificateFile“conf/ssl/domain.crt”
SSLCertificateKeyFile“conf/ssl/domain.key”
SSLCertificateChainFile“conf/ssl/domain.ca bundle.crt”
DAV svn
SVN路径“C:/svnrepo”
SSLRequireSSL
AuthName“www.domain.com”
AuthType Basic
AuthUserFile“conf/svn/users”
AuthGroupFile“conf/svn/groups”
需要有效用户
#需要在ProxyPass指令之前
ProxyPass!
代理请求关闭
代理主机
ProxyPass/ajp://127.0.0.1:8080/
ProxyPassReverse/ajp://127.0.0.1:8080/    
<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>