的ProxyPass和DocumentRoot的上一个域(ProxyPass and Documen

2019-09-01 03:46发布

比方说,我有以下配置:

<VirtualHost domain.com>
    # Server names, admins, logs etc...

    ProxyVia On
    ProxyRequests Off
    <Location "/">
        ProxyPass http://localhost:8080/tomcat-webapp/
        ProxyPassReverse http://localhost:8080/tomcat-webapp/
        Order allow,deny
        Allow from all
    </Location>
</VirtualHost>

现在,我想地址domain.com/forum显示我的MyBB论坛,哪些文件是内部的conent /var/www/forum目录。 如何做到这一点?

Answer 1:

其实,我解决了这个问题,下面的代码:

ProxyPass /forum !
ProxyPass / http://localhost:8080/tomcat-webapp/
ProxyPassReverse / http://localhost:8080/tomcat-webapp/
Alias /forum /var/www/forum


Answer 2:

它是什么,建议使用mod_rewrite来执行,而不是的ProxyPass / ProxyPassReverse命令增强了ProxyPass是。

尝试是这样的:

RewriteRule  ^/forum   -  [L]
RewriteRule  ^/(.*)    http://localhost:8080/tomcat-webapp/$1  [P,L]
ProxyPassReverse /     http://localhost:8080/tomcat-webapp/


Answer 3:

我用:

<VirtualHost *:80>
#other irrelevant configs here
ProxyPass /forum http://localhost:8080/myBB
ProxyPassReverse /forum http://localhost:8080/myBB
ProxyPass / http://localhost:8081/tomcat-app
ProxyPassReverse / http://localhost:8081/tomcat-app
</VirtualHost>

你不必说“Tomcat的应用”,如果你的Tomcat应用程序是根应用程序。



文章来源: ProxyPass and DocumentRoot on one domain