Zoom Tutorials

Linux | Windows | AWS | Azure | DevOps Tutorials

How to implement HTTP Authentication/Password protect your website in Apache

3 min read
Apache http authentication

In this tutorial, we will describe the basics of password protecting a website using HTTP authentication.

Step 1. First, we need to create password which we will use to login to the site.

# htpasswd -c /home/passwords zoomtut
New password: #####
Re-type new password: #####
Adding password for user zoomtut

Step 2. Next, we’ll need to configure the server to request a password and tell the server which users are allowed access. In order for this to happen, we will edit .htaccess file in the root of the website and enter the below lines on top of the file.

# cd /var/www/html/zoomtutorials.com/
# vi .htaccess
AuthType Basic
AuthName "Restricted Files"
# (Following line optional)
AuthBasicProvider file
AuthUserFile "/home/passwords"
Require user zoomtut

Step 3. Let’s verify by browsing the site.

Enter username and password to browse the website:

Hurray! we are in the site.

This completes the tutorial for creating password protected website. Enjoy browsing.


Please follow and like us:

Leave a Reply

Your email address will not be published. Required fields are marked *

© 2016-2020, ZoomTutorials.com