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

來源:互聯網
上載者:User

標籤:httpd2.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.環境準備

[[email protected] ~]# cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core) [[email protected] ~]# uname -anLinux Web245 3.10.0-514.6.1.el7.x86_64 #1 SMP Wed Jan 18 13:06:36 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux[[email protected] ~]# yum -y install httpd httpd-devel mariadb mariadb-libs mariadb-devel subversion mod_dav_svn mod_ssl patch

2.檔案下載及準備

mod_auth_mysql項目地址

https://sourceforge.net/projects/modauthmysql

apache22.diff補丁地址

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

wget https://nchc.dl.sourceforge.net/project/modauthmysql/modauthmysql/3.0.0/mod_auth_mysql-3.0.0.tar.gzwget https://sourceforge.net/p/modauthmysql/patches/_discuss/thread/efda3a06/c5a7/attachment/apache22.diff


3.mod_auth_mysql編譯及安裝

tar zxf mod_auth_mysql-3.0.0.tar.gzcd mod_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#return r->connection->remote_ip;#return r->connection->client_ip;#g‘ mod_auth_mysql.csed -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 -lz mod_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 -i mod_auth_mysql.la


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

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

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



本文出自 “楓林晚” 部落格,請務必保留此出處http://fengwan.blog.51cto.com/508652/1898048

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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.