Apache httpd password
This example will show how to protect your website/directory with httpd basic authentication.
Assuming that you've already installed and configured the apache service. In general nomatter what exact linux build you are using.
Create the .htpasswd file in the apache/httpd folder:
htpasswd -c /etc/httpd/.htpasswd user1 #<provide the password twice>
If need add more users:
htpasswd /etc/httpd/.htpasswd user2 #<provide the password twice>
Check that password file contain the lines for each user:
cat /etc/httpd/.htpasswd #Output user1:$apr1$lzxsIfXG$tmCvCfb49vpPFwKGVsuYz user2:$apr1$p1E9MeAf$kiAhneUwr.MhAE2kKGYHK
Next add auth. related config lines to the <Directory> tags in httpd configuration. You may add this to global <Directory> or to some specified. However the lines for thge basic http auth should be the next:
<Directory /var/www/> AuthType Basic AuthName "Restricted Content" AuthUserFile /etc/httpd/.htpasswd Require valid-user </Directory>
""