Password protection in NGINX
First, install apache2-utils:
sudo apt install apache2-utils
Generate a password for a specific user:
sudo htpasswd -c /etc/apache2/.htpasswd octomode
Generate another password, for another user (this time without the -c, because that creates a new .htpasswd file):
sudo htpasswd /etc/apache2/.htpasswd user2
Configure nginx:
location /octomode {
auth_basic "This is a password protected area shared with a peer-to-peer network of trust.";
auth_basic_user_file /etc/apache2/.htpasswd;
}
From: https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/