title: "Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache"
date: 2024-09-05T17:05:07+03:00
draft: false
---
Here's how to only allow authenticated users to view your websites - great way to boot freeloaders and guarantee your system's (*or your vps'*) resources for yourself.
The guide is meant for debian but can be easily adapted to suit your needs. I assume you have followed Luke Smith's tutorial and have NGINX running with certbot for certificates.
## Create a username and password for authentication (*or more than 1 user*)
Apache2 is only needed to create its files in /etc/ otherwsie apache2-utils commands below will fail. My configuration uses NGINX so I'll delete apache2.