不更改URL的Apache虚拟主机

时间:2019-06-17 12:21:05

标签: python apache flask web-deployment httpd.conf

我正在Windows上使用apache httpd服务器。我正在使用它来使用httpd-vhosts.conf中的虚拟主机在不同的端口中运行2个flask应用程序。

<VirtualHost *:80>
     ServerName ncapp01
     ProxyPass /app1 http://ncapp01:8081/
     ProxyPassReverse /app1 http://ncapp01:8081/

     ProxyPass /app2 http://ncapp01:8080/
     ProxyPassReverse /app2 http://ncapp01:8080/
</VirtualHost>

Listen 8081
<VirtualHost *:8081>
        ServerName  ncapp01
        WSGIScriptAlias / "C:/Sites/app1/web.wsgi"
        WSGIPassAuthorization On
        DocumentRoot "C:/Sites/app1"
        <Directory "C:/Sites/app1/">
          Options +Indexes +Includes +FollowSymLinks +MultiViews +ExecCGI
            AllowOverride All
            Require local
        </Directory>
</VirtualHost>

Listen 8080
<VirtualHost *:8080>
        ServerName  ncapp01
        WSGIScriptAlias / "C:/Sites/app2/web.wsgi"
        WSGIPassAuthorization On
        DocumentRoot "C:/Sites/app2"
        <Directory "C:/Sites/app2">
          Options +Indexes +Includes +FollowSymLinks +MultiViews +ExecCGI
            AllowOverride All
            Require local
        </Directory>
</VirtualHost>

此操作成功完成,并将/app1重定向到http://ncapp01:8081/,并将/app2重定向到http://ncapp01:8080/。但是无法管理内部链接。

例如,如果<a href="/clients">view clients </a>中有链接app1

单击时将其重定向到http://ncapp01/clients而不是http://ncapp01/app1/clients

是否有某种方法可以找出此请求来自哪个应用程序并相应地重定向,而无需更改文件中的所有链接?

0 个答案:

没有答案