English 中文(简体)
除当地东道方外,阿帕奇认证
原标题:Apache authentication except localhost

I need to apply HTTP auth just in public use of website, but I don t apply it on my localhost. This is the .htaccess that I think should work. But it doesn t work - it still asks me for user/pass.
What am I doing wrong?

SetEnvIf Remote_Addr ^127.0.0.1$ develmode
<IfDefine !develmode>
    AuthType Basic
    AuthName "ADMIN"
    AuthUserFile /path/to/.htpasswd
    Require valid-user
</IfDefine>

mod_setenvif 当然是能够做到的。

最佳回答

你们需要看<条码><>条码>和<条码>>。 我的网站上的工作实例如下。 首先,我们告诉大家,我们要么接受IP,要么接受美国ER。 然后,我们界定了绕过手法,我们接受该档案中的任何有效用户。 最后,我们界定了哪些客户IP地址可以上网而无需改动(我们否认所有其他知识产权,因此他们必须通过绕行。

# permit by USER || IP
Satisfy any
# USER
AuthUserFile /var/www/munin/.htpasswd
AuthGroupFile /dev/null
AuthName "Password Protected Area"
AuthType Basic
require valid-user
# IP
order deny,allow
deny from all
allow from 11.22.33.
问题回答

<>Apache 2.4,allow,denysatisfy不再使用,IP地址限制也使用require。 现在:

AuthUserFile /path/to/.htpasswd
AuthName "Restricted Access"
AuthType Basic
Require ip 127.0.0.1
Require valid-user

如果符合任何“要求”指令,则允许提出请求。 如果您要求,将其归入<代码><RequireAll>栏。

For restriction to local access you can use the special syntax Require local instead of Require ip 127.0.0.1

<>Read more: http://http://d.apache.org/docs/2.4/mod/mod_authz_core.html#require





相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Remotely authenticating client Windows user on demand

Suppose I am writing a server for a particular network protocol. If I know that the client is running on a Windows machine, is it possible for my server to authenticate the Windows user that owns the ...

Role/Permission based forms authorizing/authentication?

While looking into forms authorizing/authentication, I found that it is possible to do role based authorizing by adding an array of roles to a FormsAuthenticationTicket. That way I can write User....

热门标签