使用httpd proxy_ajp模块,proxy_ajp.conf配置如下
ProxyPass /examples/ ajp://localhost:8009/examples/
访问http://hostname/examples时出现如下错误:
[Wed Feb 01 15:56:37 2012] [error] (70014)End of file found: ajp_ilink_receive() can't receive header
[Wed Feb 01 15:56:37 2012] [error] ajp_read_header: ajp_ilink_receive failed
[Wed Feb 01 15:56:37 2012] [error] (120006)APR does not understand this error code: proxy: read response failed from (null) (localhost)
Tomcat启动信息:
Feb 1, 2012 4:54:34 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Feb 1, 2012 4:54:35 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8090
Feb 1, 2012 4:54:36 PM org.apache.jk.common.ChannelSocket init
INFO: Port busy 8009 java.net.BindException: Address already in use
Feb 1, 2012 4:54:36 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8010
Feb 1, 2012 4:54:36 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=1 time=0/645 config=null
Feb 1, 2012 4:54:37 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 207063 ms
解决方法:
从tomcat启动信息可以看到8009端口被使用,故修改conf/server.xml下ajp端口,由8009改为8010
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
改为
<Connector port="8010" protocol="AJP/1.3" redirectPort="8443" />
ProxyPass也修改为8010端口
ProxyPass /examples/ ajp://localhost:8010/examples/
具体为什么8009端口被使用,还不清楚,欢迎大家交流。