娟斌心 发表于 2018-11-22 11:12:02

apache 用户密码登陆设置

  1.使用htpasswd建立用户文件:
  $htpasswd -mc /etc/httpd/conf/.htpasswd admin
  

  2在网站根目录下
  $touch .htaccess
  $vim .htaccess
  
  AuthName "pls use passwd"
  AuthType Basic
  AuthUserFile /etc/httpd/conf/.htpasswd
  require valid-user
  
3修改apache配置文件,添加authconfig
  vim /etc/httpd/conf/httpd.conf
  

  
   Options Indexes FollowSymLinks
   AllowOverride AuthConfig
   Order allow,deny
   Allow from all

  

  4 /etc/init.d/httpd restart



页: [1]
查看完整版本: apache 用户密码登陆设置