基于Context Path的虚拟主机

时间:2017-07-12 09:17:01

标签: apache

<VirtualHost _default_:80>
    DocumentRoot /var/www/html
    ServerName host.company.com
    JkMount  /a/* worker_1
    JkMount  /b/* worker_2
</VirtualHost>

基于服务器上下文路径的虚拟主机。

如果url以/ r

开头,是否可以区分虚拟主机

1 个答案:

答案 0 :(得分:1)

这样的事情应该有效:

<VirtualHost _default_:80>
    DocumentRoot /var/www/html
    ServerName localhost

    <Location /a/>
    AuthType Basic
    AuthName "Path A"
    Require valid-user
    AuthUserFile passwords/a.htpasswd

    ProxyPass "http://localhost:8000/"

    </Location>

    <Location /b/>
    AuthType Basic
    AuthName "Path b"
    Require valid-user
    AuthUserFile passwords/b.htpasswd

    ProxyPass "http://localhost:8001/"

    </Location>
</VirtualHost>