1.1 使用yum安装的httpd安装mod_jk模块
mod_jk模块下载地址官网
安装httpd和httpd-devel(这个包会有apxs必须要有的)
[root@apache ~]# yum -y install httpd httpd-devel
[root@apache ~]# httpd -v #版本
Server version: Apache/2.4.6 (CentOS)
Server built: Nov 5 2018 01:47:09
[root@apache ~]# wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.46-src.tar.gz
[root@apache ~]# tar xf tomcat-connectors-1.2.46-src.tar.gz
[root@apache ~]# cd tomcat-connectors-1.2.46-src/native
[root@apache native]# ./configure --with-apxs=/usr/bin/apxs #编译模块都需要这个apxs文件
[root@apache native]# make
[root@apache native]# make install
[root@apache native]# ll /etc/httpd/modules/mod_jk* #检查是否安装成功
-rwxr-xr-x 1 root root 1556864 Dec 24 10:43 /etc/httpd/modules/mod_jk.so
1.2 配置httpd
接下来配置/etc/httpd/conf/httpd.conf 文件,在配置文件末尾添加如下代码:
LoadModule jk_module modules/mod_jk.so
<IfModule jk_module>
JkWorkersFile conf/workers.properties
JkMountFile conf/uriworkermap.properties
JkLogFile logs/mod_jk.log
JkLogLevel warn
</IfModule>