User Tools

Site Tools


nginx-basicauth

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
nginx-basicauth [2025/08/31 20:07] – created adminnginx-basicauth [2025/09/01 10:12] (current) plida
Line 1: Line 1:
 +====== 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.
 +
  
- 
nginx-basicauth.1756670869.txt.gz · Last modified: by admin