首页 → Linux教程
背景:
阅读新闻
VMware下Linux虚拟机实现浏览器登陆认证
[日期:2010-12-26]来源:Linux社区作者:ethnicitybeta[字体:]
这里指的是类似登陆数据库时时出来的那个验证框,在虚拟机下用Linux实现
[root@linuxidc ~]# mkdir /var/www/html/protect
[root@linuxidc ~]#echo “ceshi” /var/www/html/protect/index.html
[root@linuxidc ~]# mkdir /var/www/apache.passwd编辑httpd.conf添加以下的一段话
[root@linuxidc ~]# vi /etc/httpd/conf/httpd.conf
确保有这段话
<Files ~ “^\.ht”> Order allow,deny Deny from all</Files>然后找个合适的地方添加下边这段话
<Directory “/var/www/html/protect”> AllowOverride AuthConfig Order allow,deny Allow from all</Directory>
接下来
[root@linuxidc ~]# vi /var/www/html/protect/.htaccess AuthName “protect wanyan by .htaccess”Authtype BasicAuthUserFile /var/www/apache.passwdrequire valid-user然后添加登陆的用户名和密码
[root@linuxidc ~]# htpasswd /var/www/apache.passwd usernameNew password: Re-type new password: Adding password for user username
接着重启httpd
[root@linuxidc ~]#apachectl restart或者[root@linuxidc ~]#/etc/init.d/httpd restart
最后在浏览器输入即可测试验证(ip为你的Linux主机ip)
0
Linux vi命令手册
Fedora 14安装缺少iso的问题
相关资讯 Linux教程
图片资讯
本文评论 查看全部评论 (0)
评论声明
最新资讯
本周热门
Linux公社简介 – 广告服务 – 网站地图 – 帮助信息 – 联系我们本站(LinuxIDC)所刊载文章不代表同意其说法或描述,,仅为提供更多信息,也不构成任何建议。Copyright © 2006-2014 Linux公社 All rights reserved 浙ICP备06018118号
经验是由痛苦中粹取出来的