详细解析:Apache服务器实现的用户验证 打印 E-mail
  2008-01-10

Apache服务器已经内置用户验证机制,大家只要适当的加以设置,便可以控制网站的某些部分要用户验证。大家只要跟着我一步步做下来就应该能轻松实现用户验证。

前期准备,必须已经安装Apache。

第1步:

我们在/var/www(apache的主页根目录)下建立一个test目录。

mkdir /var/www/test

第2步:

然后我们编辑httpd.conf

添加

Alias /test"/var/www/test"
<Directory "/var/www/test">
Options Indexes MultiViews
AllowOverride AuthConfig #表示进行身份验证
Order allow,deny
Allow from all
</Directory>
#AllowOverride AuthConfig 表示进行身份验证 这是关键的设置

第3步:

在/var/www/test创建.htaccess文件

vi /var/www/test/.htaccess

AuthName "frank share web"

AuthType Basic

AuthUserFile /var/www/test/.htpasswd

require valid-user

#AuthName 描述,随便写

#AuthUserFile /var/www/test/.htpasswd

#require valid-user 或者 require user frank 限制是所有合法用户还是指定用户

#密码文件推荐使用.htpasswd,因为apache默认系统对“.ht”开头的文件默认不允许外部读取,安全系数会高一点哦。

 第4步:

就是创建apache的验证用户

 htpasswd -c /var/www/test/.htpasswd frank

 #第一次创建用户要用到-c 参数 第2次添加用户,就不用-c参数

如果你们想修改密码,可以如下

 htpasswd -m .htpasswd frank

 第5步:

 ok,重启apache服务,然后访问 http://你的网站地址/test 如果顺利的话,应该能看到一个用户验证的弹出窗口,只要填入第4步创建的用户名和密码就行。

为了服务器的性能,一般不推荐使用AllowOverride AuthConfig或者AllowOverride ALL,因为这会使服务器会不断的去寻找.htaccess,从而影响服务器的效能,一般我们把一些后台管理界面或者其他特殊目录可能需要加验证这个需求。

发表评论
网友评论
cv
作者 访客 于 2008-07-15 15:16:20
移民 
投资移民 
加拿大移民 
技术移民 
移民加拿大 
澳洲技术移民 
德国移民 
移民澳洲 
澳洲移民 
出国移民 
移民出国 
英国移民 
澳大利亚移民 
加拿大投资移民 
加拿大技术移民 
美国留学 
法国留学 
北欧留学 
瑞典留学 
芬兰留学 
澳洲留学 
除湿机 
抽湿机 
工业除湿机 
空气净化器 
空气净化机 
步进电机 
联轴器 
真空泵 
工作服 
职业装 
北京工作服 
定做工作服 
北京二手空调回收 
空调维修 
物资回收 
防腐设备 
风机 
铠装热电偶 
精密铸造 
美术培训 
美术高考 
美术高考培训 
画室 
北京画室 
谐波治理 
无功补偿 
防腐管道 
英美制丝锥 
继电保护测试仪 
日语学校 
日语培训 
安装卫星电视 
安装卫星天线 
北京安装卫星电视 
北京安装卫星天线 
针孔摄像机 
望远镜 
夜视仪 
探测狗 
窃听器 
无线耳机 
屏蔽器 
金属探测器 
隔墙监听器 
国标舞 
拉丁舞 
喷码机 
针孔摄像机 
烤瓷牙 
除沫器 
土壤水分速测仪 
土壤水分测定仪 
土壤水分测量仪 
土壤墒情记录仪 
农药残留速测仪 
土壤化肥速测仪 
土壤养分测试仪 
信号隔离器 
信号分配器 
隔离器 
温度变送器 
电流变送器 
配电器 
隔离配电器 
隔离模块 
糖尿病足 
煤气发生炉 
高低温试验箱 
振动试验台 
恒温恒湿试验箱 
恒温恒湿箱 
恒温箱 
振动台 
盐雾箱 
老化台 
盐雾试验箱 
高低温箱 
低温试验箱 
振动试验机 
合同纠纷 
房产纠纷 
劳动纠纷 
房地产律师 
制氮机 
在职研究生 
液体壁纸 
清水模板 
冷弯型钢 
roll forming 
开口闪点仪 
凝固点仪 
闭口闪点仪 
运动粘度仪 
粘度仪 
抗乳化测定仪 
丝网除沫器 
气液过滤网 
除雾器 
丝网除雾器 
波纹填料 
三菱电机空调 
牛仔服 
牛仔服装厂 
牛仔休闲 
牛仔裤 
牛仔品牌 
牛仔专卖店 
虹吸 
虹吸雨水 
虹吸排水 
有压流 
同层排水 
walk throught metal detector 
恒温器 
马达保护器 
热保护器 
温度开关 
温控器 
过流保护器
we
作者 访客 于 2008-08-04 14:06:23
移民 
投资移民 
加拿大移民 
技术移民 
移民加拿大 
澳洲技术移民 
德国移民 
移民澳洲 
澳洲移民 
出国移民 
移民出国 
英国移民 
澳大利亚移民 
加拿大投资移民 
加拿大技术移民 
美国留学 
法国留学 
北欧留学 
瑞典留学 
芬兰留学 
澳洲留学 
除湿机 
抽湿机 
工业除湿机 
空气净化器 
空气净化机 
步进电机 
联轴器 
真空泵 
工作服 
职业装 
北京工作服 
定做工作服 
北京二手空调回收 
空调维修 
物资回收 
防腐设备 
风机 
铠装热电偶 
精密铸造 
美术培训 
美术高考 
美术高考培训 
画室 
北京画室 
谐波治理 
无功补偿 
防腐管道 
英美制丝锥 
继电保护测试仪 
日语学校 
日语培训 
安装卫星电视 
安装卫星天线 
北京安装卫星电视 
北京安装卫星天线 
针孔摄像机 
望远镜 
夜视仪 
探测狗 
窃听器 
无线耳机 
屏蔽器 
金属探测器 
隔墙监听器 
国标舞 
拉丁舞 
喷码机 
针孔摄像机 
烤瓷牙 
除沫器 
土壤水分速测仪 
土壤水分测定仪 
土壤水分测量仪 
土壤墒情记录仪 
农药残留速测仪 
土壤化肥速测仪 
土壤养分测试仪 
信号隔离器 
信号分配器 
隔离器 
温度变送器 
电流变送器 
配电器 
隔离配电器 
隔离模块 
糖尿病足 
煤气发生炉 
高低温试验箱 
振动试验台 
恒温恒湿试验箱 
恒温恒湿箱 
恒温箱 
振动台 
盐雾箱 
老化台 
盐雾试验箱 
高低温箱 
低温试验箱 
振动试验机 
合同纠纷 
房产纠纷 
劳动纠纷 
房地产律师 
制氮机 
在职研究生 
液体壁纸 
清水模板 
冷弯型钢 
roll forming 
开口闪点仪 
凝固点仪 
闭口闪点仪 
运动粘度仪 
粘度仪 
抗乳化测定仪 
丝网除沫器 
气液过滤网 
除雾器 
丝网除雾器 
波纹填料 
三菱电机空调 
牛仔服 
牛仔服装厂 
牛仔休闲 
牛仔裤 
牛仔品牌 
牛仔专卖店 
虹吸 
虹吸雨水 
虹吸排水 
有压流 
同层排水 
walk throught metal detector 
恒温器 
马达保护器 
热保护器 
温度开关 
温控器 
过流保护器 
藏獒 
Google左侧优化 
舞台设计 
铅丝笼 
石笼网 
烧烤网 
振动筛网 
拖链 
光纤熔接机 
光缆监测系统 
光时域反射仪 
OTDR 
nike shoes 
air jordan 
不锈钢反应斧
hello
作者 访客 于 2008-08-26 23:45:13
窃听器手机窃听器监听器手机监听器窃听器手机窃听器监听器手机监听器窃听器手机窃听器监听器手机监听器窃听器手机窃听器监听器手机监听器窃听器手机窃听器监听器手机监听器
wer
作者 访客 于 2008-10-13 10:49:56
 
 
Tyrande is the High Priestess. 2GB MP3 PLAYER of the moon goddess. 4GB MP3 PLAYER Elune. buy wow gold She has served as the. buying gold world of warcraft leader of the night elf Sentinels. cell phones for nearly ten thousand years. cheap cell phones but her long vigil has left. cheap wow gold her with little. cheap wow gold mercy for those. cheap wow gold she regards as her foe. cheapest wow gold An exceptional. eve isk and fearless warrior. mp3 players she stands as one of. phones cell the greatest heroes in recorded history. portable mp3 player Following the catastrophic. portable mp3 players invasion of the Burning Legion. sell wow gold Tyrande ruled over her. world of warcraft gold people alongside her mate. wow the Arch-Druid Malfurion Stormrage. wow gold until he disappeared. wow gold into the mystic Emerald Dream. wow gold With Malfurion inexplicably lost. wow gold Tyrande has again become the sole ruler of her prideful people. wow gold Troubled by Malfurion's disappearance. wow gold she nevertheless strives. wow gold kaufen to keep the night elves from reliving the. wow gold kaufen mistakes of the past.  
 
are
作者 访客 于 2008-10-13 10:51:19
 
 
Tyrande is the High Priestess. 2GB MP3 PLAYER of the moon goddess. 4GB MP3 PLAYER Elune. buy wow gold She has served as the. buying gold world of warcraft leader of the night elf Sentinels. cell phones for nearly ten thousand years. cheap cell phones but her long vigil has left. cheap wow gold her with little mercy for those. cheap wow gold she regards as her foe. cheap wow gold An exceptional and fearless warrior. cheapest wow gold she stands as one of. eve isk the greatest heroes in recorded history. mp3 players Following the catastrophic. phones cell invasion of the Burning Legion. portable mp3 player Tyrande ruled over her. portable mp3 players people alongside her mate. sell wow gold the Arch-Druid Malfurion Stormrage. world of warcraft gold until he disappeared. wow into the mystic Emerald Dream. wow gold With Malfurion inexplicably lost. wow gold Tyrande has again become. wow gold the sole ruler of her. wow gold prideful people. wow gold Troubled by Malfurion's disappearance. wow gold she nevertheless strives. wow gold kaufen to keep the night elves from reliving the. wow gold kaufen mistakes of the past.  
asdf
作者 访客 于 2008-10-13 14:27:14
 
 
The greatest druid ever to live. 8GB MP3 PLAYER and arguably one of the most. apple ipod powerful beings in history. buy cheap wow gold Malfurion Stormrage stands as both prophet. canon digital camera and savior to his people. cheap world of warcraft gold Under the leadership of Tyrande and Malfurion. digital camera the night elves vanquished. digital cameras the Burning Legion not once. dvd player but twice. eve isk To replenish his powers. ipod Malfurion periodically hibernates within the. ipod nano spirit realm known as the Emerald Dream. ipod shuffle Recently something went wrong. ipod touch with Malfurion's dreamstate. ipods Now he is trapped somewhere. mp3 within the dream. mp3 player beyond even the reach of hte. mp3 players green dragons whose realm it is. mp4 With Malfurion lost. portable dvd players the night elves will certainly stumble into darkness. world of warcraft buy gold just as they have since time immemorial. wow To find out Malfurion's whereabouts in the Emerald Dream. wow gold read this entry. wow gold C'Thun and Ahn'Qiraj. wow leveling are related to the Nightmare. wow powerleveling that is corrupting the Emerald Dream. zubehoer mp3 player Malfurion's spirit talks in that quest linked.  
wer
作者 访客 于 2008-10-13 14:28:57
 
 
Several rare mobs spawn around this area. des po wow On the left is a small rock. free online games "hill" with ogres on it. free online war games It can be ignored as long. gold für wow as everyone stands. gold in wow close to the right wall. gold wow but sometimes you'll find a Spirestone. gold wow Battlelord or a Spirestone Lord Magus. mp3 player Also a Spirestone Butcher may. online games appear on the bridge. play war games leading into the room. po wow All drop decent rare quality items. world of warcraft gold Clear a few more ogres. world of wow and you'll see Highlord Omokk. wow europe and his two guards. wow geld Highlord Omokk is possibly the. wow geld easiest boss fight in. wow gold 1000 Lower Blackrock Spire. wow gold 5000 Sheep, sap, freeze. wow gold billig or seduce one of the guards. wow gold günstig or both if you can. wow gold verkaufen If you can only control one. wow level service have your warrior tank the. wow leveling service boss while the rest of the group focuses on killing the other ogre. wow mein gold de Omokk has one annoying ability. wow po which is an aggro clearing knockback. wow powerlevel The main tank should stand with his or her back to. a wall so the knockback doesn't lead to an accidental pull on the hill. and should be ready to re-establish aggro with taunt or mocking blow.  
 
 
ccc
作者 访客 于 2008-10-13 14:30:36
 
 
A bunch of Ogres starts to spawn. wowgold in waves of up to three. cheap wow power leveling They are Elite, they hit hard. wowgold and they spawn fast. cheapest wow gold No five-man group. gold wow could normally withstand so many elite mobs. HDRO gold but there is a trick to this encounter. level wow The pike you just planted in the skulls has a magical ability. lord of rings online gold it can nuke one ogre dead every 30 seconds. lotro gold So you must have someone on duty. lotro gold next to the pike. or wow ready to click it everytime it's possible. power level Organize your group well. power level Use sheep, succubus, and freeze traps to control them. serveur wow assist one person. wow level and take the ogres down as fast as you can. wow leveling You should have previously cleared the whole area. wow lvl so that means using. wow lvl fear in this encounter can be a lifesaver. wow lvl 60 rather than pulling in adds. wow lvl 70 Try to bring a full HP ogre next to the pike. wow or every 30 seconds and nuke it dead. wow power leveling Also, the Urok Enforcers really hurt. wow powerlevel They are easy to recognize because. wow powerlevel they use two-hand spiked maces. wow powerleveling and hit really hard Try to get those nuked down and killed fast.  
 
 

发表评论
用户访客
标题
BBCode:Web AddressEmail AddressBold TextItalic TextUnderlined TextQuoteCodeOpen ListList ItemClose List
评论



< 上一篇   下一篇 >