首页新闻找找看学习计划

Windows下Apache+Tomcat+jsp+php的服务器整合配置出现Service Unavailable错误

0
悬赏园豆:50 [已解决问题] 解决于 2015-01-24 16:09

Windows下Apache+Tomcat+jsp+php的服务器整合配置出现Service Unavailable错误
Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems.
Please try again later.
1.JDK (安装目录 L:/Java)
2.Apache2.4 (安装目录 J:/Apache24)
3.tomcat 8.0.17 (安装目录L:\service\tomcat8)
4.tomcat-connectors-1.2.39-windows-i386-httpd-2.4.x
5.PHP
网站根目录:J:\PHPWeb
系统环境Win7
由于80端口被IIS占用,Apache用8082端口,tomcat用8080端口
按照这里提供的说明
http://www.cnblogs.com/zyw-205520/p/3603262.html
配置完成以后,tomcat 能单独使用,能访问jsp页面;
apache也能单独使用,能访问html,php页面;
但是却不能通过Apache转到tomcat访问JSP页面,出现错误404,
找不到该文件。
我是这样操作的:建立项目test,test文件夹下有一个test1.html,test2.jsp两个
文件,将test文件夹一份放到L:\service\tomcat8\webapps下
另外copy一份放到网站根目录:J:\PHPWeb下。
浏览器上能访问
http://localhost:8082/test1/test1.html
http://localhost:8080/test1/test2.jsp
http://localhost:8080/test1/test1.html
但是http://localhost:8082/test1/test2.jsp却出现错误,
Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems.
Please try again later.
请问这是什么原因?如何处理?

以下是一些关键配置文件部分内容:
1、Apache的配置文件httpd.conf
Listen 8082
LoadModule jk_module "J:/Apache24/modules/mod_jk.so"
JkLogFile "L:/service/tomcat8/logs/mod_jk2.log"
JkWorkersFile "L:/ConnApaTom/workers.properties"

DocumentRoot J:/PHPWeb
DirectoryIndex index.html index.htm index.jsp index.action
JkMount /*WEB-INF ajp13
JkMount /*j_spring_security_check ajp13
JkMount /*.action ajp13
JkMount /servlet/* ajp13
JkMount /*.jsp ajp13
JkMount /*.do ajp13
JkMount /*.action ajp13


2、L:/ConnApaTom/workers.properties文件内容为
workers.tomcat_home="L:/service/tomcat8"
workers.java_home="L:/Java"
ps=/
worker.list= ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1

3、tomcat的server.xml
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />

问题补充:

已解决 

报错:jk_open_socket::jk_connect.c (735): connect to 136.83.91.0:8009 failed

将 worker.ajp13.host=localhost

 改为 worker.ajp13.host=127.0.0.1

成功。非常谢谢dudu 的耐心指导。32个赞!!!

我幸福的主页 我幸福 | 初学一级 | 园豆:77
提问于:2015-01-24 14:27
< >
分享
最佳答案
1

server.xml中的port=8080要改为8009,与 worker.ajp13.port=8009 一致。

园子的参考博文:第一篇、Apache和Tomcat的整合

收获园豆:50
dudu | 高人七级 |园豆:38722 | 2015-01-24 14:51

tomcat的server.xml中有

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

我将<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />

改为

<Connector port="8009" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />

也是不行

 

我幸福 | 园豆:77 (初学一级) | 2015-01-24 15:01

@我幸福:  telnet localhost 8009 能连上吗?

dudu | 园豆:38722 (高人七级) | 2015-01-24 15:07

@dudu: cmd 输入 telnet localhost 8009  可以连上

我幸福 | 园豆:77 (初学一级) | 2015-01-24 15:10

@我幸福: 重启一下Apache试试, service httpd restart 

dudu | 园豆:38722 (高人七级) | 2015-01-24 15:16

@dudu: tomcat apache 每次修改都会重启,已经纠结很久,还是有问题。

我幸福 | 园豆:77 (初学一级) | 2015-01-24 15:17

@dudu: 我的项目就是一个test文件夹下有一个test1.html,test2.jsp两个
文件。这个不会有问题吧?

我幸福 | 园豆:77 (初学一级) | 2015-01-24 15:18

@我幸福: 问题不在这里,应该是mod_jk.so没正常工作,建议看一下L:/service/tomcat8/logs/mod_jk2.log中有没有相关信息

dudu | 园豆:38722 (高人七级) | 2015-01-24 15:22

@我幸福: 问题可能出在这个配置:

LoadModule jk_module "J:/Apache24/modules/mod_jk.so" 
JkLogFile "L:/service/tomcat8/logs/mod_jk2.log" 
JkWorkersFile "L:/ConnApaTom/workers.properties"

建议参考这里的配置:

LoadModule jk_module modules/mod_jk-1.2.31-httpd-2.2.3.so
JKWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log

将workers.properties文件放在apache的config文件夹中

dudu | 园豆:38722 (高人七级) | 2015-01-24 15:27

@dudu: 这是最近的L:/service/tomcat8/logs/mod_jk2.log信息:

[Sat Jan 24 15:00:03.907 2015] [7464:8160] [info] jk_open_socket::jk_connect.c (735): connect to 136.83.91.0:8009 failed (errno=60)
[Sat Jan 24 15:00:03.907 2015] [7464:8160] [info] ajp_connect_to_endpoint::jk_ajp_common.c (1019): Failed opening socket to (136.83.91.0:8009) (errno=60)
[Sat Jan 24 15:00:03.907 2015] [7464:8160] [error] ajp_send_request::jk_ajp_common.c (1659): (ajp13) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[Sat Jan 24 15:00:03.907 2015] [7464:8160] [info] ajp_service::jk_ajp_common.c (2669): (ajp13) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
[Sat Jan 24 15:00:25.014 2015] [7464:8160] [info] jk_open_socket::jk_connect.c (735): connect to 136.83.91.0:8009 failed (errno=60)
[Sat Jan 24 15:00:25.014 2015] [7464:8160] [info] ajp_connect_to_endpoint::jk_ajp_common.c (1019): Failed opening socket to (136.83.91.0:8009) (errno=60)
[Sat Jan 24 15:00:25.014 2015] [7464:8160] [error] ajp_send_request::jk_ajp_common.c (1659): (ajp13) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[Sat Jan 24 15:00:25.014 2015] [7464:8160] [info] ajp_service::jk_ajp_common.c (2669): (ajp13) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
[Sat Jan 24 15:00:25.014 2015] [7464:8160] [error] ajp_service::jk_ajp_common.c (2689): (ajp13) connecting to tomcat failed.
[Sat Jan 24 15:00:25.014 2015] [7464:8160] [info] jk_handler::mod_jk.c (2806): Service error=-3 for worker=ajp13
[Sat Jan 24 15:17:40.845 2015] [2384:2388] [info] init_jk::mod_jk.c (3383): mod_jk/1.2.39 initialized
[Sat Jan 24 15:17:44.387 2015] [9368:9744] [info] init_jk::mod_jk.c (3383): mod_jk/1.2.39 initialized
[Sat Jan 24 15:17:44.548 2015] [9368:9744] [info] init_jk::mod_jk.c (3383): mod_jk/1.2.39 initialized
[Sat Jan 24 15:18:06.198 2015] [9368:9612] [info] jk_open_socket::jk_connect.c (735): connect to 136.83.35.0:8009 failed (errno=60)
[Sat Jan 24 15:18:06.199 2015] [9368:9612] [info] ajp_connect_to_endpoint::jk_ajp_common.c (1019): Failed opening socket to (136.83.35.0:8009) (errno=60)
[Sat Jan 24 15:18:06.199 2015] [9368:9612] [error] ajp_send_request::jk_ajp_common.c (1659): (ajp13) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[Sat Jan 24 15:18:06.199 2015] [9368:9612] [info] ajp_service::jk_ajp_common.c (2669): (ajp13) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
[Sat Jan 24 15:18:27.332 2015] [9368:9612] [info] jk_open_socket::jk_connect.c (735): connect to 136.83.35.0:8009 failed (errno=60)
[Sat Jan 24 15:18:27.332 2015] [9368:9612] [info] ajp_connect_to_endpoint::jk_ajp_common.c (1019): Failed opening socket to (136.83.35.0:8009) (errno=60)
[Sat Jan 24 15:18:27.332 2015] [9368:9612] [error] ajp_send_request::jk_ajp_common.c (1659): (ajp13) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[Sat Jan 24 15:18:27.332 2015] [9368:9612] [info] ajp_service::jk_ajp_common.c (2669): (ajp13) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
[Sat Jan 24 15:18:27.332 2015] [9368:9612] [error] ajp_service::jk_ajp_common.c (2689): (ajp13) connecting to tomcat failed.
[Sat Jan 24 15:18:27.333 2015] [9368:9612] [info] jk_handler::mod_jk.c (2806): Service error=-3 for worker=ajp13
[Sat Jan 24 15:26:37.584 2015] [9368:9612] [info] jk_open_socket::jk_connect.c (735): connect to 136.83.35.0:8009 failed (errno=60)
[Sat Jan 24 15:26:37.585 2015] [9368:9612] [info] ajp_connect_to_endpoint::jk_ajp_common.c (1019): Failed opening socket to (136.83.35.0:8009) (errno=60)
[Sat Jan 24 15:26:37.585 2015] [9368:9612] [error] ajp_send_request::jk_ajp_common.c (1659): (ajp13) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[Sat Jan 24 15:26:37.585 2015] [9368:9612] [info] ajp_service::jk_ajp_common.c (2669): (ajp13) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
[Sat Jan 24 15:26:58.700 2015] [9368:9612] [info] jk_open_socket::jk_connect.c (735): connect to 136.83.35.0:8009 failed (errno=60)
[Sat Jan 24 15:26:58.700 2015] [9368:9612] [info] ajp_connect_to_endpoint::jk_ajp_common.c (1019): Failed opening socket to (136.83.35.0:8009) (errno=60)
[Sat Jan 24 15:26:58.700 2015] [9368:9612] [error] ajp_send_request::jk_ajp_common.c (1659): (ajp13) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[Sat Jan 24 15:26:58.700 2015] [9368:9612] [info] ajp_service::jk_ajp_common.c (2669): (ajp13) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
[Sat Jan 24 15:26:58.700 2015] [9368:9612] [error] ajp_service::jk_ajp_common.c (2689): (ajp13) connecting to tomcat failed.
[Sat Jan 24 15:26:58.700 2015] [9368:9612] [info] jk_handler::mod_jk.c (2806): Service error=-3 for worker=ajp13

我幸福 | 园豆:77 (初学一级) | 2015-01-24 15:27

@我幸福: 问题出在这里 connect to 136.83.91.0:8009 ,应该是连 connect to 127.0.0.1:8009 

dudu | 园豆:38722 (高人七级) | 2015-01-24 15:29

@dudu: 你 ping localhost 看返回的IP地址是多少?

dudu | 园豆:38722 (高人七级) | 2015-01-24 15:29

@dudu: 127.0.0.1

我幸福 | 园豆:77 (初学一级) | 2015-01-24 15:31

@dudu: 这个  136.83.91.0:8009  怎么来的?怎么设置成连 connect to 127.0.0.1:8009 

我幸福 | 园豆:77 (初学一级) | 2015-01-24 15:32

@我幸福: 说明 worker.ajp13.host=localhost 这个设置没生效,可能是workers.properties没起作用

dudu | 园豆:38722 (高人七级) | 2015-01-24 15:35

@dudu: 那这个136.83.91.0  是啥?从何而来,我的IP也不是这个啊?Apache的端口是8082不是80会引起其他吗?

我幸福 | 园豆:77 (初学一级) | 2015-01-24 15:38

@我幸福: 在httpd.conf中加上下面的配置试试:

JkMount /test1/*.jsp ajp13
dudu | 园豆:38722 (高人七级) | 2015-01-24 15:40
dudu | 园豆:38722 (高人七级) | 2015-01-24 15:45

@dudu: 加上JkMount /test/*.jsp ajp13

还是同样的问题

我幸福 | 园豆:77 (初学一级) | 2015-01-24 15:45

@我幸福: 把 worker.ajp13.host=localhost 改为 worker.ajp13.host=127.0.0.1 试试

dudu | 园豆:38722 (高人七级) | 2015-01-24 15:48

@我幸福: workers.properties中的 ps=/ 是干吗的?最好去掉

dudu | 园豆:38722 (高人七级) | 2015-01-24 15:50

@dudu: 改成这样居然可以了,为何?

我幸福 | 园豆:77 (初学一级) | 2015-01-24 15:51

@我幸福: 改成127.0.0.1就可以了?

dudu | 园豆:38722 (高人七级) | 2015-01-24 15:53

@dudu: 是啊,改成worker.ajp13.host=127.0.0.1   就行了。这是什么逻辑?太感谢你了。

我幸福 | 园豆:77 (初学一级) | 2015-01-24 15:55

@我幸福: 可能是你电脑上安装的什么软件拦截了localhost的IP解析

dudu | 园豆:38722 (高人七级) | 2015-01-24 15:57

@dudu: 可能吧,电脑上安装了各种软件。非常感谢你。

我幸福 | 园豆:77 (初学一级) | 2015-01-24 16:00
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册