Nginx

From Han Wiki
Jump to navigation Jump to search

Configuring basic authentication in Nginx

  • Last tested on Ubuntu 20.04, nginx v1.18.0 (2023-03-17)
$ apt install apache2-utils
$ htpasswd -c /etc/nginx/conf.d/.htpasswd developer

Once the file has been created, -c is no longer needed.

  ..
  auth_basic "Restricted Access!";
  auth_basic_user_file /etc/nginx/conf.d/.htpasswd;
  ..