apt-get install libapache2-mod-auth-mysql
a2enmod auth_mysql
<Location />
AuthName "Zionetrix Access"
AuthType Basic
AuthUserFile /dev/null
AuthGroupFile /dev/null
AuthBasicAuthoritative Off
Auth_MySQL_Authoritative On
Auth_MYSQL on
Auth_MySQL_Host localhost
Auth_MySQL_User myuser
Auth_MySQL_Password mypassword
Auth_MySQL_DB mydatabase
Auth_MySQL_Password_Table users
Auth_MySQL_Username_Field username
Auth_MySQL_Password_Field password
Auth_MySQL_Encryption_Types Crypt MD5
Auth_MySQL_Password_Clause " AND allowed=1"
require valid-user
</Location>