文章归档

Apache用户认证方法汇总

一.基本的Apache用户认证方法:

若对某一目录下的文件如/home/ftp/pub需要做到用户认证,则在httpd.conf
中加入下面的行
<>
options indexes followsymlinks
allowoverride authconfig
order allow,deny
allow from all

<>
用在目录/home/ftp/pub下放文件.htaccess,内容如下:
authname ”shared files”
authtype basic
authuserfile /etc/.passwd
require valid-user

用随Apache来的程序htpasswd 生成文件/etc/.passwd,每行一个用户名:密码

只要能提供正确的用户名和密码对,就允许登录访问,这是针对任何地址来的
请求都要求提供用户名和密码认证。

二.针对部分网段或地址要求认证。

阅读更多 »

Share

虚拟主机支持

下面是我配置的虚拟主机内容.

NameVirtualHost *
<VirtualHost *>
ServerName www.ptubuntu.com
DocumentRoot /home/www/html/
</VirtualHost>
如果你的主机上没有设置有两个.那么这第一个是默认的主机.所以你要添加只能添加下面两个新的虚拟主机才是正确的.
<VirtualHost *>
ServerName lab.test.com
DocumentRoot /home/www/html/test
</VirtualHost>
<VirtualHost *>
ServerName beta.test.com
DocumentRoot /home/www/html/test
</VirtualHost>

Share
Page 1 of 11