Jan302020
NGINX Basic Authentication
Required package
-
For Debian:
apache2-utils.sudo apt-get install apache2-utils -
For Fedora:
httpd-tools.sudo dnf install httpd-tools
Create password file
Run with -c option if /etc/nginx/.htpasswd does not exist:
sudo htpasswd -c /etc/nginx/.htpasswd user1
If .htpasswd already exists, don't use -c option or file will be overwritten.
To add more user to password file.
sudo htpasswd /etc/nginx/.htpasswd user2