close
If you use the htaccess and htpasswd to protect the directory on Apache, please see the below

1. Modify the /etc/httpd/conf/httpd.conf
Enable those module
mod_authn_file.so
mod_authz_user.so
mod_authz_owner.so
mod_authz_groupfile.so

2. edit htaccess

AuthUserFile /var/www/html/test/.htpasswd
AuthGroupFile /dev/null
AuthName "Sample"
AuthType Basic


require valid-user


3. htpasswd -b .htpasswd $user $password

4. restart apache


if you see the error message "Internal Server Error" via browser and "'AuthUserFile', perhaps misspelled or defined by a module not included in the server configuration" in error_log
please see the apache configure file, if those modules enables.
arrow
arrow
    全站熱搜

    coolkevin 發表在 痞客邦 留言(0) 人氣()