我有一个基于Debian的Web服务器,在端口80上有一个主虚拟主机。在这里,我为AuthType Basic生成了一组用户。
<Directory /var/www/example/public_html>
AuthType Basic
AuthName "Protected Zone"
AuthUserFile /var/www/.protected/.passwd_collection
Require valid-user
Options -Indexes +FollowSymLinks
AllowOverride All
</Directory>
用户成功完成访问后,同一计算机上但端口不同(例如8081、8082等)的其他虚拟主机必须可以访问它。
如何从端口80向其他虚拟主机共享授权?
在VirtualHost外部在全局级别配置目录并进行测试。
<Directory /var/www/example/public_html>
AuthType Basic
AuthName "Protected Zone"
AuthUserFile /var/www/.protected/.passwd_collection
Require valid-user
Options -Indexes +FollowSymLinks
AllowOverride All
</Directory>