ght 发表于 2015-12-23 13:57:53

apache 目录访问验证

  假设apache的根目录是 /opt/wwwroot
  那么 httpd.conf 里的 DocumentRoot 就是 /opt/wwwroot
  1.建立用户
  htpasswd -c /opt/wwwroot/.htpasswd xampp
  其中 .htpasswd 是存储账户密码的文件 xampp 是用户名
  系统会要求您输入 两边密码
  2.编辑httpd.conf
  在httpd.conf里加入如下几句代码

  
   AuthType basic
   AuthName "Authorization "
   AuthUserFile /opt/wwwroot/.htpasswd
   Require user xampp


  其中"/opt/wwwroot/"就是要权限访问的目录
  AuthUserFile 放存账户密码的文件
  Require user 后紧跟 允许访问的用户名
  3.重启 apache
页: [1]
查看完整版本: apache 目录访问验证