小编典典

从virtualhost proxypass排除别名

linux

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

  1. 如果有人请求http://test.myserver.com/myapp,则apache通过/ var / www / myapp为他服务
  2. 如果请求http://test.myserver.com/,则apache将其重定向到端口8069。

2号正在工作,但1号却没有。有人可以帮忙吗!

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

阅读 262

收藏
2020-06-07

共1个答案

小编典典

这就是我能够达到预期结果的方式。以下是有效的配置,ProxyPassMatch ^/myapp !除了(服务器地址)/
myapp外,所有请求都正在代理到另一台运行在端口8069的open-erp服务器:

<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>
2020-06-07