Apache的重写同时作为反向代理

问题描述 投票:0回答:1
  • 我已经example.com:8080/second在Apache Tomcat运行。
  • 我的Apache2作为80端口的服务页面作为example.com反向代理
  • 很多代码都是指向“第二”的目录,但是因为Apache充当反向代理example.com:8080/second是“第二”目录不能被浏览器看到的。

我想用一个apache重写重定向东西要到第二个文件夹的站点的根目录或/。不过,我当我去http://example.com/second/css/style.css它不拉http://example.com/css/style.css

我试过如下:Apache Reverse Proxy ReWrite但是当我把ProxyHTMLEnable在我的conf文件的Apache无法启动。

这就是我现在想。 Apache没有开始,但我没有得到期望的效果重定向:

    <VirtualHost *:80>
        ServerName example.com
        ServerAdmin [email protected]

        SetEnvIf Request_URI ".(jpg|jpeg|png|swf|css|gif|dat|ico|js)$" dontlog

        #SetEnvIf Request_URI "/cron/" dontlog
        LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" varnishcombined

        RewriteEngine On
        RewriteRule ^second/(.*)$ /$1 [R=301,NC,L]
       # ProxyRequests Off
       # <Proxy *>
       #   Order deny,allow
       #   Allow from all
       # </Proxy>
        ProxyPass / http://127.0.0.1:8080/second/
        ProxyPassReverse / http://127.0.0.1:8080/second/
        <Location />
          Order allow,deny
          Allow from all
        </Location>
   </VirtualHost>
apache tomcat mod-rewrite url-rewriting reverse-proxy
1个回答
0
投票

有意者请将中的conf文件,因为我可以用0.0.0.0成功下方设置试试。

ProxyPreserveHost On
ProxyPass / http://0.0.0.0:8080/second/
ProxyPassReverse / http://0.0.0.0:8080/second/
© www.soinside.com 2019 - 2024. All rights reserved.