Mysql authentication on Apache 2.4
I discovered that mod_auth_mysql has been replaced with mod_auth_dbd on Centos 7 and Apache 2.4. The following is a quick reference to setting mod_auth_dbd up
<VirtualHost 10.10.10.10:80>
# tell DBD you are using mysql
DBDriver mysql
# how to access the database that contains the usernames and passwords
# host = server running the sql server. Can be ip address or FQDN
# dbname = name of the database that contains the table that has the users
# user = username that has at least read access to the table that has the users
# pass = password of the above user
DBDParams "host=localhost dbname=WebUsers user=WebUserDBAdmin pass=L3tM30ut"
# Minimum number of connections
DBDMin 4
# Maximum sustained number of connections
DBDKeep 8
#Set the hard maximum number of connections per process
DBDMax 20
# Set the time to keep idle connections alive when the number of connections specified in DBDKeep has been exceeded
DBDExptime 300
<Directory /opt/MyWebSite>
#sql querry that will return the password for the selected user
# passwords should be stored the database using the mysql "encrypt" function
AuthDBDUserPWQuery "select user_passwd from users where user_name=%s"
<RequireAll>
AuthType Basic
AuthName "My Web Site"
Require valid-user
AuthBasicProvider socache dbd
</RequireAll>
</Directory>
(other parameters as needed)
</VirtualHost>
For more information, see https://httpd.apache.org/docs/2.4/de/mod/mod_dbd.htm and https://httpd.apache.org/docs/2.4/mod/mod_authn_dbd.html.
