Install Apache for the MySQL User Authentication Module of Apache2.x
I mentioned MySQL User authentication on the Samba Server. In fact, I have already written Apache authentication for MySQL. However, it was only a test before and was not actually used. As mentioned above, knowledge management actually runs a pLog-based blog system within the company. The original system was not released to the internet. later, in order to allow the company's branches in different regions to use the blog system, they decided to publish the system to the Internet. To minimize the Hack of the blog system, I decided to use the plug-in mod_auth_mysql module to implement user authentication, thus reducing the risk of exposing the company's internal system to unauthorized users.
During this installation, it was found that mod_auth_mysql has several versions, and the documentation is almost all incomplete. The program downloaded in this article is from sourceforge.net (sf.net)
Http://modauthmysql.sourceforge.net/
The current version is 2.9.0. after downloading the file, create the directory mod_auth_mysql and decompress it. (Do not decompress the package directly under/usr/local/src). follow the instructions in the BUILD file to install the package as follows:
Apxs-c-lmysqlclient-lm-lz mod_auth_mysql.c
Apxs-I mod_auth_mysql.la
Then add the following line to httpd. conf.
LoadModule mysql_auth_module modules/mod_auth_mysql.so
In fact, compilation and installation are not difficult. configuration is a big challenge, especially the combination of existing user tables. The user table of my plog database is plog_users. the configuration I set is as follows:
AuthType Basic
# Host address used to connect to the database. generally, it is a local host.
AuthMySQLHost localhost
AuthMySQLPort nnnn
# Database name
AuthMySQLDB plog
# Database Connection users?
AuthMySQLUser plogdb_user
# Database connection password
AuthMySQLPassword password
# None: not encrypted (plain text)
# Crypt: UNIX crypt () encryption
# Scrambled: MySQL PASSWORD encryption
# Md5: MD5 hashing
# Aes: Advanced Encryption Standard (AES) encryption
# Sha1: Secure Hash Algorihm (SHA1 )'
AuthMySQLPwEncryption md5
AuthMySQLEnable On
AuthMySQLUserTable plog_users
AuthMySQLNameField user
AuthMySQLPasswordField password
AuthMySQLGroupTable plog_users
AuthMySQLGroupField user_group
As you can see from the above configuration, this module does not have special requirements for the user table, as long as the user name and the corresponding password can be found, if you need to verify a group, the group column is required.
All users in the company have the same group. Therefore, group users are generally used for verification. Therefore, you must add the column user_group in the plog_user table, update the user_group column of all rows to a fixed value, for example, mygroup.
Here, groupTable and UserTable are the same table. if you want a user to belong to multiple groups, you must create another group table.
After completing the preceding steps, add the. htaccess file to the directory to be encrypted as follows:
Authname "Please log in with the password and password for managing the blog"
Authtype Basic
Require group mygroup
Such a plug-in verification system has been deployed, which is very effective for user table integration of multiple different applications in e-commerce applications. There are not many modified codes.
You can use PHP's $ _ SERVER ["PHP_AUTH_USER"] to change the user password to determine the user name and then make the corresponding judgment.
After using this authentication method, your browsing records can be kept in Apache logs. you can view your views using awstats and other log statistics software, the knowledge flow inside the company can be clearly viewed.