Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision |
| nginx-basicauth [2025/08/31 20:07] – created admin | nginx-basicauth [2025/09/01 10:12] (current) – plida |
|---|
| | ====== Basic authentication in NGINX ====== |
| | |
| [[https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/|NGINX documentation]] | [[https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/|NGINX documentation]] |
| |
| In Yetti the authentication is done in the LXC container. | In Yetti the authentication is done in the LXC container. |
| | |
| Steps: | ==== Steps: ==== |
| |
| * ''sudo apt install apache2-utils'' -- not necessary to use this command, there are alternatives | * ''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 | * ''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. |
| | <code>auth_basic "Administrator's Area"; |
| | |
| | auth_basic_user_file /etc/nginx/.htpasswd; |
| | </code> |
| | |
| | ==== 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. |
| | |
| |
| * | |