nginx-basic-auth

nginx-basic-auth #

config #

text
auth_basic "Welcome";
auth_basic_user_file /etc/nginx/htpasswd/test-users;

htpasswd #

bash
# CentOS
sudo yum install -y httpd-tools
# Ubuntu
sudo apt-get install -y apache2-utils

# Usage: help
htpasswd -h
# Usage: add user "bob" in new file "users" and prompt for password
htpasswd -c users bob
# Usage: add or update user "bob" in file "users" and prompt for new password
htpasswd users bob
# Usage: add or update user "bob" in file "users" with new password "123456"
htpasswd -b users bob 123456
2024年3月15日