允许用户或ips使用apache进行访问

问题描述 投票:0回答:1

我有.htpasswd中的用户和.htaccess中允许的IP我想允许用户/密码(对于不在.htaccss中的IP)或IP来访问(没有auth)。

我使用这些行编辑了httpd中的dir部分但是它要求不在文件中的允许的IP和IP的用户/密码不会被要求进行身份验证。

<Directory xxx>
    AllowOverride All
    Options Indexes FollowSymLinks
    AuthName "Authentication required!"
    AuthType Basic
    AuthUserFile <my path>/.htpasswd
    <RequireAny>
        Require ip 127.0.0.1
        Require valid-user
    </RequireAny>
</Directory>
apache .htaccess httpd.conf .htpasswd
1个回答
0
投票

这些配置对我有用

  AllowOverride All
  AuthType Basic
  AuthName "Authentication Required"
  AuthUserFile "/my path/.htpasswd"
  Require valid-user
  satisfy any
  deny from all
  allow from x.x.x.x
© www.soinside.com 2019 - 2024. All rights reserved.