Step 1 - Log in to cPanel (click here for a guide) and click on Directory Privacy
Step 2 - Click on public_html
NOTE: If you want to only password protect a subdomain, subfolder or addon domain (eg: test.yourdomain.net.au or yourdomain.net.au/membersarea/ ) you can use this menu to navigate to that folder)
Step 3 - (1) Tick Password protect this directory (2) Enter a name for your reference (3) click Save
Now add a user and hit Save
That's all done!
Now when someone visits your site they will get this pop up before and content loads: