Amit Dhamu

Software Engineer

HTTP Authentication


  • apache2-utils or httpd-tools

Generate a password

sudo htpasswd -c /etc/apache2/.htpasswd amit

If you want to add multiple credentials, omit the -c flag:

sudo htpasswd /etc/apache2/.htpasswd another_user

Add the following to your Apache vhost or NGINX config


AuthUserFile /etc/apache2/.htpasswd
AuthName "Administrator's Area"
AuthType Basic

<Limit GET POST>
    require valid-user


location /protected {
    auth_basic "Administrator's Area";
    auth_basic_user_file /etc/apache2/.htpasswd;

http / authentication / security / apache / htaccess / nginx

← Toggle Text Function Double Click Event →