Apache basic authentication – how to disable on dev computer

apache-2.2http-basic-authentication

I'm disabling access to some folders to unauthorized users this way:

AuthUserFile /var/www/passwords/.htpasswd_private
AuthType Basic
AuthName "Access to private admin section"
Require valid-user

It works fine on the production (Ubuntu) server.
The problem is I want the same code to allow access (or at least ask for password) on a windows dev computer.

Tried adding

Allow from 127.0.0.1

But the logs show error because it cannot find the password file on the dev computer.
The system cannot find the path specified. : Could not open password file: C:/var/www/passwords/.htpasswd_private

Whats the elegant way to tell apache to either allow access or ask for password on the dev computer?

Best Answer

Create the directory C:/var/www/passwords/.htpasswd_private and then use the htpasswd.exe program that comes with your apache installation to create the .htpasswd_private file

htpasswd -c C:/var/www/passwords/.htpasswd_private username
Automatically using MD5 Format
New password: *********
Re-type password: *********
Adding password for user username

Now you should have a system works like your production server.