Password protection in NGINX: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
First, install apache2-utils | First, install apache2-utils: | ||
sudo apt install apache2-utils | sudo apt install apache2-utils | ||
Latest revision as of 21:12, 26 January 2026
First, install apache2-utils:
sudo apt install apache2-utils
Generate a password for a specific user:
sudo htpasswd -c /etc/apache2/.htpasswd octomode
Generate another password, for another user (this time without the -c, because that creates a new .htpasswd file):
sudo htpasswd /etc/apache2/.htpasswd user2
Configure nginx:
location /octomode {
auth_basic "This is a password protected area shared with a peer-to-peer network of trust.";
auth_basic_user_file /etc/apache2/.htpasswd;
}
From: https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/