How to implement a first line of defense password-protection for areas of a website using NGINX's auth_basic
Create a password file
htpasswd passwordFilename userName
Add auth_basic
to NGINX config file
Edit the NGINX configuration file location
section
location /api {
auth_basic "Sensitive Area";
auth_basic_user_file passwordFilename;
}
References
6 / 2023