CentOS 7下httpd-2.4.6的mod_auth_mysql安装及配置

前端之家收集整理的这篇文章主要介绍了CentOS 7下httpd-2.4.6的mod_auth_mysql安装及配置前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

因为环境的迁移,我们将SVN由CentOS 6.8迁移至CentOS 7.3,原先的httpd-2.2.15已经升级为httpd-2.4.6,通过yum安装httpd mod_auth_MysqL在CentOS 7.3已经不支持了。


1.环境准备

[root@Web245~]#cat/etc/redhat-release
CentOSLinuxrelease7.3.1611(Core)
[root@Web245~]#uname-an
LinuxWeb2453.10.0-514.6.1.el7.x86_64#1SMPWedJan1813:06:36UTC2017x86_64x86_64x86_64GNU/Linux
[root@Web245~]#yum-yinstallhttpdhttpd-develmariadbmariadb-libsmariadb-develsubversionmod_dav_svnmod_sslpatch

2.文件下载及准备

mod_auth_MysqL项目地址

https://sourceforge.net/projects/modauthmysql

apache22.diff补丁地址

https://sourceforge.net/p/modauthmysql/patches/7/

wgethttps://nchc.dl.sourceforge.net/project/modauthMysqL/modauthMysqL/3.0.0/mod_auth_MysqL-3.0.0.tar.gz
wgethttps://sourceforge.net/p/modauthMysqL/patches/_discuss/thread/efda3a06/c5a7/attachment/apache22.diff


3.mod_auth_MysqL编译及安装

tarzxfmod_auth_MysqL-3.0.0.tar.gz
cdmod_auth_MysqL-3.0.0
#对模块打补丁
patch-p0<../apache22.diff

修改源码

908行:由[return r->connection->remote_ip;]变为[return r->connection->client_ip;]

1273行: 由[const apr_array_header_t *reqs_arr = ap_requires(r);]变为[const apr_array_header_t *reqs_arr = apr_table_elts(r->headers_in);]

sed-i's#returnr->connection->remote_ip;#returnr->connection->client_ip;#g'mod_auth_MysqL.c
sed-i's#ap_requires(r)#apr_table_elts(r->headers_in)#g'mod_auth_MysqL.c


编译

apxs-c-L/usr/lib64/MysqL-I/usr/include/MysqL-lMysqLclient-lm-lzmod_auth_MysqL.c

若出现以下错误

/usr/bin/ld: cannot find -lMysqLclient

collect2: error: ld returned 1 exit status

apxs:Error: Command Failed with rc=65536

则可能是路径指错了

apxs -c -L/usr/lib/MysqL -I/usr/include/MysqL -lMysqLclient -lm -lz mod_auth_MysqL.c

修改以上红色部分为/usr/lib64/MysqL即可


安装

apxs-imod_auth_MysqL.la


################################################################

以上补丁部分也可以直接使用apache2.4的补丁

https://sourceforge.net/p/modauthmysql/patches/13/

原文链接:https://www.f2er.com/centos/378728.html

猜你在找的CentOS相关文章