>_ IzzyLab

Topic breakdown

HTTP Basic Auth is the simplest way to protect a page: the server answers 401 with a WWW-Authenticate header until the client sends a login and password. nginx doesn't keep the passwords in plain text but in an htpasswd file — a login and a hash, created by the htpasswd utility. Protection is turned on precisely in the right location with the auth_basic and auth_basic_user_file directives, so you can lock one section and leave the rest of the site open. Basic Auth sends the password only base64-encoded, so in production it's used only over HTTPS.

What's checked

  1. /stats/ answers 401 without a password
  2. a wrong password doesn't get in
  3. owner with the right password opens /stats/
  4. the home page is open without a password

What it looks like