允许 IP 地址无需身份验证 [英] Allow IP address without authentication

查看:30
本文介绍了允许 IP 地址无需身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经建立了一个网站,目前正在进行中.我正在使用需要访问我服务器上的脚本的外部 SMS 网关.但是,我为普通用户设置了基本的用户名密码认证,但是短信网关无法通过.

I have set up a site that is currently work in progress. I'm using an external SMS gateway that needs access to a script on my server. However, I have set up a basic username and password authentication for regular users, but the SMS gateway can't get through that.

如何允许单个 IP 在不进行身份验证的情况下通过身份验证,并拒绝所有其他未通过身份验证的用户?

How can I allow a single IP to pass through the authentication without authenticating itself, and deny all other users that aren't authenticated?

这是我的 .htaccess 文件:

Order allow,deny
Allow from all
AuthType Basic
AuthUserFile /www/.site_htpasswd
AuthName "Protected Area"
require user admin

推荐答案

UPDATE: 从 Apache 2.4 开始,OrderAllowDenySatisfy 指令 不应再使用.所以新的语法是:

UPDATE: As of Apache 2.4, Order, Allow, Deny, and Satisfy directives should not be used anymore. So the new syntax is:

AuthType Basic
AuthUserFile /www/.site_htpasswd
AuthName "Protected Area"

<RequireAny>
    Require ip 1.2.3.4
    Require valid-user
</RequireAny>

这篇关于允许 IP 地址无需身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆