简体   繁体   English

配置mod_jk以在CentOS7上通信Tomcat 8和Apache 2.4

[英]Configuring mod_jk to communicate Tomcat 8 and Apache 2.4 on CentOS7

I've installed Apache 2.4 and Tomcat 8 on a CentOS 7 VM and both work fine. 我已经在CentOS 7 VM上安装了Apache 2.4和Tomcat 8,并且都可以正常工作。

Now I'd like to install and configure mod_jk, an apache httpd module used to make apache tomcat applications interact with a httpd server. 现在,我想安装和配置mod_jk,这是一个apache httpd模块,用于使apache tomcat应用程序与httpd服务器进行交互。

I've tried to follow this step-by-step tutorial http://www.diegoacuna.me/installing-mod_jk-on-apache-httpd-in-centos-6-x7-x/ downloading the last mod_jk version source code and compiling it on my CentOS7 system. 我试图按照此分步教程http://www.diegoacuna.me/installing-mod_jk-on-apache-httpd-in-centos-6-x7-x/下载最新的mod_jk版本源代码并在我的CentOS7系统上进行编译。

I've configured my Tomcat installation service.xml file then I've created a /etc/httpd/conf.d/mod_jk.conf its contents is 我已经配置了Tomcat安装service.xml文件,然后创建了/etc/httpd/conf.d/mod_jk.conf其内容为

LoadModule jk_module "/etc/httpd/modules/mod_jk.so"

JkWorkersFile /etc/httpd/conf/workers.properties
# Where to put jk shared memory
JkShmFile     /var/run/httpd/mod_jk.shm
# Where to put jk logs
JkLogFile     /var/log/httpd/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel    info
# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
#JkRequestLogFormat "%w %V %T"
#JkEnvVar SSL_CLIENT_V_START worker1

and then a file /etc/httpd/conf/workers.properties its contents is 然后是一个文件/etc/httpd/conf/workers.properties其内容是

workers.apache_log=/var/log/httpd
worker.list=app1Worker
worker.stat1.type=status

worker.app1Worker.type=ajp13
worker.app1Worker.host=192.168.33.10 #put your app host here
worker.app1Worker.port=8009

and, latest, a file /etc/httpd/conf.d/192.168.33.10.conf its contents is 最后是文件/etc/httpd/conf.d/192.168.33.10.conf其内容为

<VirtualHost *:80>
    ServerName 192.168.33.10
    ServerAdmin admin@myhost.com
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
    CustomLog /var/log/httpd/192.168.33.10_access.log combined
    ErrorLog /var/log/httpd/192.168.33.10_error.log
    <IfModule mod_jk.c>
       JkMount /* app1Worker
    </IfModule>
</VirtualHost>

Then I've stop and start both Apache and Tomcat and the situation is: 然后,我停止并启动Apache和Tomcat,情况是:

http://192.168.33.10: ok Apache is working
http://192.168.33.10:8080: ok, Tomcat is working 
http://192.168.33.10:8080/examples: ok, Tomcat is working
http://192.168.33.10/examples: KO .... ?????

Probably there are some errors in my configurations but I don't know where: any suggestions will be appreciated 我的配置中可能有一些错误,但我不知道在哪里:任何建议将不胜感激

Looking at an ubuntu installation with mod_jk from the repository (I never bother to compile from source), I find the following lines, related to yours but not identical: 从存储库中查看使用mod_jk进行的ubuntu安装(我从不麻烦从源代码进行编译),我发现以下几行与您的相关,但并不相同:

LoadModule jk_module "/etc/httpd/modules/mod_jk.so"

and, the important one: 重要的是:

<IfModule jk_module>

And the description of your problem sounds like your <IfModule mod_jk.c> block is not taken into account 而且问题的描述听起来像没有考虑您的<IfModule mod_jk.c>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM