【问题标题】:Apache and tomcat in the same VirtualhostApache和tomcat在同一个虚拟主机
【发布时间】:2012-04-14 06:06:37
【问题描述】:

我有一个看起来像这样的虚拟主机:

<VirtualHost *:80>
    ServerName www.mysite.com
    SetOutputFilter DEFLATE
    RedirectMatch ^/manager$ http://www.fna.fi/manager/
    DocumentRoot /build/vhosts/mysite.com
    ErrorLog /build/logs/site.com-error.log
    CustomLog /build/logs/site.com-access.log combined
    ProxyRequests Off
    RewriteEngine on

    ProxyPass /manager http://127.0.0.1:8060/manager/ retry=0
    ProxyPassReverse /manager http://127.0.0.1:8060/manager

    ProxyPass / http://127.0.0.1:8060/app/ retry=0
    ProxyPassReverse / http://127.0.0.1:8060/app/
 </VirtualHost>

现在我想在 /build/vhosts/mysite.com 中添加一个博客。所以它会是:http://www.mysite.com/blog 但是当我访问这个站点时,它看起来像是被转发到 Tomcat(很可能是由于“ProxyPass /...”。

有没有办法让它适用于我的场景?

谢谢!

【问题讨论】:

    标签: apache tomcat proxypass


    【解决方案1】:

    目前任何东西都会被转发到tomcat:

    ProxyPass / http://127.0.0.1:8060/app/ retry=0
    ProxyPassReverse / http://127.0.0.1:8060/app/
    

    您必须在您的代理指令之前添加一个别名到您的配置:

    Alias /blog /build/vhosts/mysite.com
    <Location /blog>
        # make some configs for this location like...
        Options FollowSymLinks
        AllowOverride None
    </Location>
    

    【讨论】:

    • 当您向mysite.com/blog 提出请求时,您能否说明您的日志内容?
    • 这是一条 404 消息:- - [01/Apr/2012:09:20:39 +0200] "GET /blog HTTP/1.1" 404 3626 "-"
    • 这是因为它在 / 上使用了 Tomcat 服务器 .. 并且没有 /blog。
    • 对不起。我确信,定义的位置首先捕获请求并传递内容。我需要在我自己的测试服务器上检查一下。
    • 修复是使用 ProxyPass /blog !如此处所述:httpd.apache.org/docs/2.0/mod/mod_proxy.html
    猜你喜欢
    • 2011-06-11
    • 2014-04-09
    • 2011-09-20
    • 2014-05-28
    • 1970-01-01
    • 2014-01-19
    • 2014-09-08
    • 1970-01-01
    • 2011-12-24
    相关资源
    最近更新 更多