In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces MySQL how to achieve Apache user authentication, the article is very detailed, has a certain reference value, interested friends must read it!
Apache requires DSO to compile and install, assuming that apache is installed in the / usr/local/apache directory and mysql in the / usr/local/mysql directory
First download mod_auth_mysql at http://www.bruce.com.cn/software... _ mysql-2.9.0.tar.gz
[root@www software] # tar xzfv mod_auth_mysql-2.9.0.tar.gz
[root@www software] # cd mod_auth_mysql-2.9.0
[root@www mod_auth_mysql-2.9.0] # / usr/local/apache/bin/apxs-c-I/usr/local/mysql/include-L/usr/local/mysql/lib-lmysqlclient-lm-lz mod_auth_mysql.c
[root@www mod_auth_mysql-2.9.0] # / usr/local/apache/bin/apxs-I mod_auth_mysql.la
Then edit the httpd.conf file
[root@www mod_auth_mysql-2.9.0] # vi / usr/local/apache/conf/httpd.conf
Add the following lines to httpd.conf: (the following is an excerpt from my httpd.conf)
LoadModule mysql_auth_module modules/mod_auth_mysql.so
AuthType Basic
AuthMySQLHost localhost
AuthMySQLPort 3306
AuthMySQLDB database # Database to be accessed
AuthMySQLUser mysql_user # users accessing the database
AuthMySQLPassword user_password # user password
AuthMySQLPwEncryption md5 # MD5 encryption
AuthMySQLEnable On
AuthMySQLUserTable user_table # data tables to be accessed
Fields of AuthMySQLNameField username # username
AuthMySQLPasswordField password # password field
AuthMySQLGroupTable user_table # is the same as user table
AuthMySQLGroupField mygroup # user Group Field
As you can see from the above configuration, this module actually has no special requirements for the user table, as long as you can find the user name and the corresponding password, and if you need to authenticate a group, you need the group column.
Since all users within the company have the same group, it is common to use group users to authenticate, so add the column: user_group to the plog_user table and update the user_group column of all rows to a solid
A fixed value, such as mygroup.
Here groupTable and UserTable are the same table, and if you need a user to belong to more than one group, you must create a separate group table.
After you have done the above work, add the .htaccess file to the directory that needs to be encrypted as follows:
[root@www MySQL] # more / home/bruce/html/software/.htaccess
AuthType Basic
AuthName "Resource downloads are for members only"
Require valid-user
Restart apache again
[root@www mod_auth_mysql-2.9.0] # service httpd restart
After adopting this authentication measure, users' browsing records can be retained in the Apache log, and users' browsing times can be seen by using log statistics software such as awstats, so that the knowledge flow within the company can be seen clearly.
The above is all the content of the article "how to achieve Apache user authentication in MySQL". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.