在代理后运行 depot 服务器的最重要原因是可以在具有不同前缀的一个域名下轻松运行多个系统信息库。配置带有前缀的简单代理中的示例可以轻松扩展为支持多个系统信息库。
在本示例中,一个域名的三个不同前缀连接到三个不同的软件包系统信息库:
http://pkg.example.com/repo_one 连接到 internal.example.com:10000
http://pkg.example.com/repo_two 连接到 internal.example.com:20000
http://pkg.example.com/xyz/repo_three 连接到 internal.example.com:30000
pkg(5) depot 服务器采用 SMF 管理的服务。因此,要在同一个主机上运行多个 depot 服务器,只需要创建一个新的服务实例:
$ svccfg -s pkg/server add repo1 $ svccfg -s pkg/server:repo1 setprop pkg/property=value $ ...
和前一个示例一样,每个 depot 服务器运行 200 个线程。
Redirect /repo_one http://pkg.example.com/repo_one/ ProxyPass /repo_one/ http://internal.example.com:10000/ nocanon max=200 Redirect /repo_two http://pkg.example.com/repo_two/ ProxyPass /repo_two/ http://internal.example.com:20000/ nocanon max=200 Redirect /xyz/repo_three http://pkg.example.com/xyz/repo_three/ ProxyPass /xyz/repo_three/ http://internal.example.com:30000/ nocanon max=200