This page looks plain and unstyled because you're using a non-standard compliant browser. To see it in its best form, please upgrade to a browser that supports web standards. It's free and painless.

修性不修命,萬劫陰靈難入聖; 修命不修性,猶有家財無主柄
Album | Blog | Comment | Profile | Control Panel
aquatower | 1 August,2009 10:18

3. Secure Directory and basic configuration

#cd /var/www/html
#mkdir secure

#cat > index.html <
> Secure page
> secure page
> ookk

(1)create .htaccess and .htpasswd
#vi /var/www/html/secure/.htaccess
AuthName "restricted stuff"
AuthType basic
AuthUserFile /etc/httpd/conf/.htpasswd
require valid-user

#htpasswd -cm /etc/httpd/conf/.htpasswd student
% c : create(只有在第一次使用)
% m: md5
#htpasswd -m /etc/httpd/conf/.htpasswd joe
#chgrp apache .htpasswd
#chmod 640 .htpasswd

(2) vi /etc/httpd/conf/httpd.conf
#edit (記要加"<", 因與html語法有重覆,故意不加"<")
Directory "/var/www/html/secure">
Options -Indexes
AllowOverride AuthConfig
/Directory>

(3) 重新啟動
#service httpd restart

http://server118.example.com/secure

就會提示要輸入username, password

 



Comment

Trackback

Comment Permissions: Only members may comment. If you are not a PIXNET member, click here to sign up.