zeromax 发表于 2018-11-17 08:56:56

apache虚拟目录的创建及身份验证功能的开启

apache虚拟目录的创建及身份验证功能的开启
  实验环境:服务端:centos6.5 IP192.168.10.10
  客户端:win7
  1.echo "test01" > /var/www/html/index.html      //将首页改为test01
  vim /etc/httpd/conf/httpd.conf

  //添加可识别网页文件类型
  vim vuser.conf                              //自定义创建虚拟目录
  Alias /test"/opt/test"
  
  Options Indexes MultiViews FollowSymLinks
  AllowOverride None
  AuthName "hello"
  authtype basic
  authuserfile /etc/httpd/user
  require Valid-user
  

  echo "this is vdir test" > /opt/test/index.html   //在opt/test/ 创建网页"this is vdir test"
  客户端访问服务端IP:http://192.168.10.10/test/

  虚拟目录创建成功
  2.开启身份验证功能
  htpasswd -c /etc/httpd/user baixiaosheng      //创建虚拟用户baixiaosheng,并设置密码
  vim vuser.conf

  service httpd restart                     //重启服务
  客户端再次访问服务端

  需验证身份才能访问站点

页: [1]
查看完整版本: apache虚拟目录的创建及身份验证功能的开启