ProxyPass and DocumentRoot on one domain

牧云@^-^@ 提交于 2019-12-21 03:21:51

问题


Let's say I have the following configuration:

<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>

Now, I want the address domain.com/forum to display conent of my MyBB forum, which files are inside /var/www/forum directory. How to accomplish this?


回答1:


Actually, I resolved this problem with the following code:

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



回答2:


What it is recommending is using mod_rewrite to perform the ProxyPass instead of ProxyPass/ProxyPassReverse command.

Try something like:

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



回答3:


I use:

<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>

You don't have to say "tomcat-app" if your tomcat app is the root app.



来源:https://stackoverflow.com/questions/16224135/proxypass-and-documentroot-on-one-domain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!