2016-10-11 28 views
0

我的最后一个驹是在每个子域名上输入密码,但不是www和local。Apache 2.4在子域名上需要密码,似乎没有工作

我遵循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

回答

0

我发现我自己的问题的解决方案不要求密码工作。

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

这泰勒斯要求对所有其他情况下,除了本地主机和www.domain.ee

有效用户