Answer the question
In order to leave comments, you need to log in
How does http basic auth work?
With this script I generate htpasswd for Nginx:
#!/bin/bash
set -e
echo "**********************************************"
echo ".htpasswd file for JSDocs protection generated"
echo "**********************************************"
read -p 'Login: ' uservar
if [ -z "$uservar" ]; then
echo "Login must by non empty string!"
exit 1
fi
HTPASWD_LOGIN="$uservar"
HTPASWD_PASSWORD=$(openssl passwd)
str="${HTPASWD_LOGIN}:${HTPASWD_PASSWORD}"
echo $str > ./.htpasswd
sudo cp ./.htpasswd /var/www/html/
rm -f ./.htpasswd
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question