Configuration: Protecting content with basic authentication Linux Http Apache.
There are two configuration steps which you must complete in order to protect a resource using basic authentication. Or three, depending on what you are trying to do.
- Create a password file
- Set the configuration to use this password file
Create Folder
mkdir /pwd_http
htpasswd -c /pwd_http/password.file username
Example:
# htpasswd -c /pwd_http/password.file user1
New password: password_use1
Re-type new password: password_user1
Adding password for user user1
Edit or create the file. Htaccess the website of the folder where files are located.
# vi .htaccess
AuthType Basic
AuthName "Password Required"
AuthUserFile /password_http/password.file
Require valid-user
AuthName "Password Required"
AuthUserFile /password_http/password.file
Require valid-user
Restart service https
# /etc/init.d/httpd restart
Test Login Website.
More info:# man htpasswd
Test Login Website.
More info:# man htpasswd
No hay comentarios:
Publicar un comentario