I followed this guide for my Ubuntu 18.04 server and opted the virtual host method (there are two methods to setup Apache auth, one is Virtual Host Definition and other one requires
.htaccess file), I opted the first one namely the Virtual Host Definition. I followed the guide but config file in the guide didn’t worked for me so I had to improvise :). This is my config file that worked for me.
Require all granted
AuthName "Restricted Content"
Checkout this link for more.