Apache basic authentication except for those Allowed

前端 未结 5 781
一个人的身影
一个人的身影 2020-12-13 19:59

Problem: I have some files under /var/www/files/ that I want them to be accessed from specific IP addresses WITHOUT requiring user/password. However, I would like that any o

5条回答
  •  醉梦人生
    2020-12-13 20:48

    This is how it's done for Apache 2.4+ (since Satisfy Any is no longer supported).

    
    
        AuthType Basic
        AuthName "Please enter your username and password"
        AuthUserFile /var/www/files/.htpasswd
    
        
          Require ip 22.33.44.55
          Require valid-user
        
    
    
    

    If you want to require both IP address -and- Login/Password, change to

    I hope this helps someone - as it took me a while to figure it out.

提交回复
热议问题