this command for create user and password access file:
htpasswd -c /etc/httpd/conf/.htpasswd xxxx
chown root:apache /etc/httpd/conf/.htpasswd
chmod 640 /etc/httpd/conf/.htpasswd
Is possible generate the row to add to the file /etc/httpd/conf/.htpasswd from here
htpasswd [ -c ] [ -i ] [ -m | -B | -d | -s | -p ] [ -C cost ] [ -D ] [ -v ] passwdfile username
htpasswd -b [ -c ] [ -m | -B | -d | -s | -p ] [ -C cost ] [ -D ] [ -v ] passwdfile username password
htpasswd -n [ -i ] [ -m | -B | -d | -s | -p ] [ -C cost ] username
htpasswd -nb [ -m | -B | -d | -s | -p ] [ -C cost ] username password
In my vhost configuration file:
ServerName sm.saic.it
RewriteEngine On
DocumentRoot /usr/local/sendmailanalyzer/www
Options ExecCGI
AddHandler cgi-script .cgi
DirectoryIndex sa_report.cgi
<Directory “/usr/local/sendmailanalyzer/www”>
AuthType Basic
AuthName “Restricted Content”
AuthUserFile /etc/httpd/conf/.htpasswd
Require valid-user
# Apache 2.4
# Require all granted
#Require host example.com
# Apache 2.2
Order deny,allow
#Allow from all
#Allow from 127.0.0.1
#Allow from ::1
# Allow from .example.com