User Tools

Site Tools


nginx-basicauth

Basic authentication in NGINX

NGINX documentation

In Yetti the authentication is done in the LXC container.

Steps:

* sudo apt install apache2-utils – not necessary to use this command, there are alternatives

* sudo htpasswd -c /etc/nginx/.htpasswd user1 – create user with login user1

* Inside /etc/nginx/sites-enabled/config either in /location or outside to protect the whole site.

auth_basic "Administrator's Area";  

auth_basic_user_file /etc/nginx/.htpasswd;

Issues

* 503 Forbidden error even after inputting correct login&password most likely means .htpasswd file is misplaced. Check tail -f /var/log/nginx/error.log to find where NGINX is trying to find it, and put the file there.

nginx-basicauth.txt · Last modified: by plida