【问题标题】:Apache 2.4 require password on subdomain not seems to be workingApache 2.4 要求子域上的密码似乎不起作用
【发布时间】:2016-10-13 15:36:58
【问题描述】:

我的最终目标是作为每个子域的密码,但不是 www 和本地。

我遵循https://httpd.apache.org/docs/trunk/howto/auth.html 指南。 “来自该地址的访问者将无法看到该指令涵盖的内容。如果您有机器名称而不是 IP 地址,则可以使用它。”

AuthType Basic
AuthName "Password Required"
<If "req('Host') == 'dev.domain.ee'">
    AuthUserFile /path/dev/.htpasswd
</If>
<If "req('Host') == 'test.domain.ee'">
    AuthUserFile /path/test/.htpasswd
</If>
<If "req('Host') == 'prelive.domain.ee'">
    AuthUserFile /path/prelive/.htpasswd
</If>
<RequireAll>
    Require all granted
    Require not host dev.domain.ee test.domain.ee  prelive.domain.ee
</RequireAll>

在 dev.domain.ee 上不询问密码仍然无法正常工作

【问题讨论】:

    标签: apache apache2.4


    【解决方案1】:

    我为自己的问题找到了解决方案。

    <RequireAny>
         Require host www.domain.ee
         Require local
         Require valid-user
    </RequireAny>
    

    这说明除了 localhost 和 www.domain.ee 之外的所有其他情况都需要有效用户

    【讨论】:

      猜你喜欢
      • 2012-12-12
      • 2012-02-14
      • 2019-01-13
      • 2015-06-04
      • 2020-03-25
      • 2017-12-22
      • 2017-01-15
      • 2019-01-19
      • 1970-01-01
      相关资源
      最近更新 更多