首页 > Web开发 > 详细

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

时间:2018-08-27 14:00:31      阅读:165      评论:0      收藏:0      [点我收藏+]
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"
<Directory "/opt/test/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
AuthName "hello"
authtype basic
authuserfile /etc/httpd/user
require Valid-user
</Directory>
技术分享图片
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 //重启服务
客户端再次访问服务端
技术分享图片
需验证身份才能访问站点

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

原文:http://blog.51cto.com/13842738/2164844

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!