分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 软件开发

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

发布时间:2023-09-06 02:12责任编辑:顾先生关键词: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"
<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

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved