9404803 发表于 2017-1-8 08:03:53

Apache(五)设置资源访问限制

以下[]中的表示可选项,实际中不能包含[]及其内容
 
  一、指定目录的AuthType
  <Directory /root/apache2>
  AuthType Basic
  </Directory>
  二、设置AuthName,该信息将在客户端提醒框上显示
  <Directory /root/apache2>
  AuthType Basic
  AuthName "Entry username and password"
  </Directory>
  三、指定AuthUserFile,指定用户名和密码存放的文件,密码文件的创建参考附录一
  <Directory /root/apache2>
  AuthType Basic
  AuthName 请输入用户名和密码
  AuthUserFile /usr/file/password
  </Directory>
  四、设置验证方式
  <Directory /root/apache2>
  AuthType Basic
  AuthName "Entry username and password"
  AuthUserFile /usr/file/password
  Require user rote  [验证方式参考 http://roteg.iteye.com/blog/1465380]
  </Directory>
  附录一、创建用户信息文件
  使用 htpasswd -c /root/apache2/auth/password rote 123
  若AuthType使用的是digest,则是用htdigest创建密钥文件
  创建文件passwd,并初始创建用户rote,密码123
  验证、
  客户端访问时会提示“Entry username and password”,输入rote/123才可访问资源
页: [1]
查看完整版本: Apache(五)设置资源访问限制