本文介绍了从virtualhost proxypass排除别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在关注虚拟主机配置.理想的结果是:

I've following virtual host configuration. The desired result is:

  1. 如果有人请求 http://test.myserver.com/myapp ,则apache服务来自/var/www/myapp
  2. 的他
  3. 如果 http://test.myserver.com/是请求,apache将其重定向到端口8069.
  1. If someone requests http://test.myserver.com/myapp, apache serveshim from /var/www/myapp
  2. And if http://test.myserver.com/ isrequested, apache redirects it to port 8069.

第2个正在工作,但第1个却没有.有人可以帮忙吗!

2nd is working but 1st is not. Can someone help please!

<VirtualHost *:80>
        ServerName test.myserver.com

        Alias /myapp /var/www/myapp
        <Directory /var/www/myapp>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                Allow from all
        </Directory>

        ProxyPass / http://localhost:8069/
        ProxyPassReverse / http://localhost:8069/

</VirtualHost>

推荐答案

这是我达到预期结果的方式.以下是ProxyPassMatch ^/myapp !发挥作用的工作配置,除了(server-address)/myapp以外,所有请求都正在代理到另一台服务器,该服务器在端口8069上运行open-erp:

This is how I was able to achive the desired outcome. Following is the working configuration where ProxyPassMatch ^/myapp ! did the trick and except the (server-address)/myapp, all the requests are being proxying to the other server which is open-erp running at port 8069:

<VirtualHost *:80>
        ServerName test.myserver.com

        Alias /myapp /var/www/myapp
        <Directory /var/www/myapp>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                Allow from all
        </Directory>

        ProxyPassMatch ^/myapp !
        ProxyPass / http://localhost:8069/
        ProxyPassReverse / http://localhost:8069/


  CustomLog /var/log/apache2/access.log common
  ErrorLog /var/log/apache2/error.log

</VirtualHost>

这篇关于从virtualhost proxypass排除别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-27 12:37