zoukankan      html  css  js  c++  java
  • 学习Apache(三)

    对某个目录开启验证登录

    <Directory /var/www/html/admin >
        AllowOverride All
        Order allow,deny
        Allow from all
        AuthType Basic
        AuthName "hehe"
        AuthUserFile /etc/httpd/conf/htpasswd_file
        Require user admin
    </Directory>

    配置如下

     解释下

    AuthName "hehet"                                 #此处为描述
    AuthType Basic                                   #验证类型
    AuthUserFile /etc/httpd/conf/htpasswd_file       #密码文件的路径

     然后执行命令把声明的密码放入配置文件中,这里第一个参数是用户名admin,第二个参数是密码

    # htpasswd -bc /etc/httpd/conf/htpasswd_file admin admin

    生成后的密码可以看到变成加密的了

    # cat /etc/httpd/conf/htpasswd_file 
      admin:$apr1$PJMPb4wK$A/iGGSv4jgU2OAhcJsuhE.

    多次执行显示的不一样

    # cat /etc/httpd/conf/htpasswd_file
      admin:$apr1$PJMPb4wK$A/iGGSv4jgU2OAhcJsuhE.
    # htpasswd -bc /etc/httpd/conf/htpasswd_file admin admin# cat /etc/httpd/conf/htpasswd_file
      admin:$apr1$pi1dWCyH$wBNx4bMNDTz1JnnSRc2Yq1
    # htpasswd -bc /etc/httpd/conf/htpasswd_file admin admin# cat /etc/httpd/conf/htpasswd_file
      admin:$apr1$pJifA1Yz$tohiVP1dIjVNsXhWJCQJu1

      

  • 相关阅读:
    mysql 更改字符集
    修改pip源
    git命令
    virtualwrapper使用
    Python环境搭建
    IntellIJ IDEA 配置 Maven 以及 修改 默认 Repository
    Spring4:JDBC
    Spring3:AOP
    Spring2:bean的使用
    Spring1:Spring简介、环境搭建、源码下载及导入MyEclipse
  • 原文地址:https://www.cnblogs.com/wuhg/p/11447216.html
Copyright © 2011-2022 走看看