apache安裝於/usr/local/apache,主頁在/usr/local/apache/htdocs
#vi /usr/local/apache/htdocs/.htAccess
AuthName Protected
AuthUserFile /usr/local/apache/.htpasswd
AuthType Basic
require valid-user
#vi /usr/local/apache/.htpasswd
robert:A101E2ThTjG4.
#/usr/local/apache/bin/htpasswd [-c] /usr/local/apache/.htpasswd robert
沒有該.htpasswd文件時使用一次-c,以後無需使用。 (陳緒)