Linux
1、/www/client/photo
2、vi httpd.conf
3、vi /www/client/photo/.htaccess
AuthName "请输入访问相册的帐号密码:"
AuthType Basic
AuthUserFile /www/client/photo/.htpasswd
require valid-user
4、htpasswd -c /var/www/test/.htpasswd ltsnet
输入密码,ok。
修改密码用:htpasswd -m .htpasswd ltsnet
5、/usr/local/apache/bin/apachectl restart
WIN2000
1、d:\soft
2、vi httpd.conf
<Directory "d:/soft">
AuthType Basic
AuthName 请输入访问密码:
AuthUserFile c:/Apache2/user
require valid-user
Order allow,deny
Allow from all
#下面为目录列表
Options Indexes MultiViews
IndexOptions FancyIndexing ScanHTMLTitles NameWidth=128 DescriptionWidth=256 HTMLTable VersionSort FoldersFirst
IndexOrderDefault Ascending Date
</Directory>
3、c:\Apache2\bin>htpasswd.exe -c c:\\apache2\\user ltsnet
输入密码,ok。
4、重启apache服务
1、/www/client/photo
2、vi httpd.conf
<Directory "/www/client/photo">
Options Indexes MultiViews
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
Options Indexes MultiViews
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
3、vi /www/client/photo/.htaccess
AuthName "请输入访问相册的帐号密码:"
AuthType Basic
AuthUserFile /www/client/photo/.htpasswd
require valid-user
4、htpasswd -c /var/www/test/.htpasswd ltsnet
输入密码,ok。
修改密码用:htpasswd -m .htpasswd ltsnet
5、/usr/local/apache/bin/apachectl restart
WIN2000
1、d:\soft
2、vi httpd.conf
<Directory "d:/soft">
AuthType Basic
AuthName 请输入访问密码:
AuthUserFile c:/Apache2/user
require valid-user
Order allow,deny
Allow from all
#下面为目录列表
Options Indexes MultiViews
IndexOptions FancyIndexing ScanHTMLTitles NameWidth=128 DescriptionWidth=256 HTMLTable VersionSort FoldersFirst
IndexOrderDefault Ascending Date
</Directory>
3、c:\Apache2\bin>htpasswd.exe -c c:\\apache2\\user ltsnet
输入密码,ok。
4、重启apache服务
引用
net stop apache2
net start apache2
net start apache2