install .htaccess
add user
cd /where/your/secret/.htpasswd/file/will/be/created
htpasswd -c .htpasswd usertocreate
htpasswd .htpasswd anotheruser |
cd /where/your/secret/.htpasswd/file/will/be/created
htpasswd -c .htpasswd usertocreate
htpasswd .htpasswd anotheruser
create .htaccess file
in the directory you want to control access, create a new file like
vi .htaccess
AuthUserFile /pathtowhereyouwantthepasswordfile/.htpasswd
AuthName "Authorization Required"
AuthType Basic
require valid-user
chown www-data.www-data .htaccess (use whatever your system uses for apacheuser/group, Ubuntu is www-data.www-data) |
vi .htaccess
AuthUserFile /pathtowhereyouwantthepasswordfile/.htpasswd
AuthName "Authorization Required"
AuthType Basic
require valid-user
chown www-data.www-data .htaccess (use whatever your system uses for apacheuser/group, Ubuntu is www-data.www-data)
tell apache to allow .htaccess use
open your apache directive file for your site and change the AllowOverride line to
AllowOverride AuthConfig
/etc/init.d/apache2/reload |
AllowOverride AuthConfig
/etc/init.d/apache2/reload
now visit your page, you should get a prompt for a username/password