我们已将 Apache 配置为通过 AJP 默认 8009 的不同端口重定向到 tomcat 实例。它仅适用于默认端口,但不适用于我们在worker.properties 上设置的端口(8109) 这是我们的场景
/etc/apache2 上的worker.properties
worker.list=sacmimexico
# Set properties for sacmimexico
worker.sacmimexico.type=ajp13
worker.sacmimexico.host=localhost
worker.sacmimexico.port=8109
server.xml 位于 /usr/share/instance-tomcat-7.0.42/sacmimexico/conf/
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8109" protocol="AJP/1.3" redirectPort="8143" />
mod_jk.log 位于 /var/log/apache2
[Wed Oct 14 05:29:18 2015] [17752:140024424515392] [info] init_jk::mod_jk.c (3189): mod_jk/1.2.30 initialized
[Wed Oct 14 05:29:18 2015] [17753:140024424515392] [info] init_jk::mod_jk.c (3189): mod_jk/1.2.30 initialized
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [info] jk_open_socket::jk_connect.c (622): connect to 127.0.0.1:8009 failed (errno=111)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [info] ajp_connect_to_endpoint::jk_ajp_common.c (959): Failed opening socket to (127.0.0.1:8009) (errno=111)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [error] ajp_send_request::jk_ajp_common.c (1585): (sacmimexico) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [info] ajp_service::jk_ajp_common.c (2540): (sacmimexico) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [info] jk_open_socket::jk_connect.c (622): connect to 127.0.0.1:8009 failed (errno=111)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [info] ajp_connect_to_endpoint::jk_ajp_common.c (959): Failed opening socket to (127.0.0.1:8009) (errno=111)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [error] ajp_send_request::jk_ajp_common.c (1585): (sacmimexico) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [info] ajp_service::jk_ajp_common.c (2540): (sacmimexico) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [error] ajp_service::jk_ajp_common.c (2559): (sacmimexico) connecting to tomcat failed.
[Wed Oct 14 05:29:22 2015] sacmimexico 199.187.122.163 0.100588
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [info] jk_handler::mod_jk.c (2618): Service error=-3 for worker=sacmimexico
/etc/apache2/mods-available 上的 jk.conf
<IfModule mod_jk.c>
JkWorkersFile "/etc/apache2/workers.properties"
JkLogFile "/var/log/apache2/mod_jk.log"
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
</IfModule>
默认位于 /etc/apache2/sites-available
JkMount /sacmimexico/* sacmimexico
版本:
Apache 2:Apache/2.2.16(Debian)
Tomcat 7:Apache Tomcat/7.0.42
mod-jk:1.2.30-1squeeze1
我们知道 Tomcat 正在该端口 8109 上工作 有谁知道发生什么事吗?
谢谢
阿尔伯特
问题是由于编辑错误,workers.properties 上的 carachters 错误。 我用 cat -Aworkers.properties 检查它,然后从头开始创建一个新的。
我遇到了完全相同的问题。此问题的解决方法是将 AJP 端口更改为不同的范围。在我的 CentOS /Red Hat 中,端口 8109 被 SELinux 阻止。因此,我将woker.proberties以及Tomcat server.xml上的AJP端口更改为81。这样问题就解决了。