如何在 Apache 中合并多个 ProxyPass 指令?

SyR*_*ity 3 configuration apache-2.2

由于我们使用以下形式的部署系统,我需要将 ProxyPass 配置保存在单独的文件中:

文件 1:

<VirtualHost *:80>
    <Location /qa1/>
        ProxyPass http://localhost:8800/qa1/
        ProxyPassReverse http://localhost:8800/qa1/
        ProxyPassReverseCookiePath / /qa1/
    </Location>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

文件2:

<VirtualHost *:80>
    <Location /qa2/>
        ProxyPass http://localhost:8801/qa2/
        ProxyPassReverse http://localhost:8801/qa2/
        ProxyPassReverseCookiePath / /qa2/
    </Location>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

但 Apache 抱怨:[警告]默认VirtualHost 在端口 80 上重叠,第一个优先

知道是否/如何让 Apache 合并这两种配置?

Lad*_*ada 5

使用Include.

文件 1: qa1.conf

<Location /qa1/>
    ProxyPass http://localhost:8800/qa1/
    ProxyPassReverse http://localhost:8800/qa1/
    ProxyPassReverseCookiePath / /qa1/
</Location>
Run Code Online (Sandbox Code Playgroud)

文件2: qa2.conf

<Location /qa2/>
    ProxyPass http://localhost:8801/qa2/
    ProxyPassReverse http://localhost:8801/qa2/
    ProxyPassReverseCookiePath / /qa2/
</Location>
Run Code Online (Sandbox Code Playgroud)

文件 3: vhost.conf

<VirtualHost *:80>
    Include qa1.conf
    Include qa2.conf
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)