【问题标题】:Allow either users OR ips to access using apache允许用户或 ips 使用 apache 访问
【发布时间】:2019-07-07 01:49:45
【问题描述】:

我在 .htpasswd 中有用户,在 .htaccess 中有允许的 IP 我想允许用户/密码(对于不在 .htaccss 中的 IP)或 IP 访问(没有身份验证)。

我用这些行编辑了 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】:

    这些配置对我有用

      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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-06-27
      • 2011-03-07
      • 2017-07-28
      • 2018-04-03
      • 1970-01-01
      • 1970-01-01
      • 2020-06-18
      相关资源
      最近更新 更多