Installation of the MySQL user authentication module for Apache 2.x

Source: Internet
Author: User
Tags crypt md5 sha1

Before talking about the MySQL user authentication of the Samba server, I've actually written the Apache authentication for MySQL. But it used to be just a test, not actually used. The above mentioned knowledge management, in fact within the company we run a plog based blog system. The original system was not posted to the Internet, and it was decided to publish to the Internet in order to make it available to various branches of the company. In order to minimize the Hack of the blog system, so I decided to use the plug-in Mod_auth_mysql module to achieve user authentication, thereby reducing the company's internal system exposure to unauthorized users of the risk.

In this installation, only to find that the original Mod_auth_mysql have several versions, and the document is almost incomplete. This article downloads the program from SourceForge.net (sf.net)

http://modauthmysql.sourceforge.net/

The current version of 2.9.0, after downloading, establishes the directory Mod_auth_mysql, and then enters the directory for decompression. (Do not extract directly under/USR/LOCAL/SRC), according to the build file instructions, the installation steps are as follows:

apxs -c -lmysqlclient -lm -lz mod_auth_mysql.c
apxs -i mod_auth_mysql.la

and add the following line to the httpd.conf.

LoadModule Mysql_auth_module modules/mod_auth_mysql.so

In fact, compilation and installation is not difficult, configuration is the larger challenge, especially to have already existing user table combined. The user table for my Plog database is plog_users, and I set the configuration as follows:

<ifmodule mod_auth_mysql.c>

<location/>

AuthType Basic

# Connect to the host address of the database, generally with local connection, so for localhost

Authmysqlhost localhost

Authmysqlport nnnn

# Name of the database

Authmysqldb Plog

# Users connecting to the database?

Authmysqluser Plogdb_user

# Password to connect to the database

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
</Location>
</IfModule>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.