如何一起运行Apache(httpd)和Tomcat?

loc*_*ock 9 apache server-configuration web-services

我最近得到了在Struts上运行的项目,我期待更多的JSP即将推出.

在谷歌搜索问题后,我被引导到试图做同样事情的人的博客.这些博客并不完全是他们如何做到这一步的一步一步的过程,但更像是一个参考,以防他们将来需要做同样的事情.在某些情况下,作者没有确切地说他是否成功地试图同时运行上述两种服务.

Unfortunately, I can't follow their "instructions" as I have plenty of PHP projects configured (upload directories, classpaths etc...) to run on my test server and I don't have the luxury of time to reconfigure them all in case I mess up with the httpd server. And for honesty's sake, I haven't tried a single step on running them together for the same reason of being hesitant to update configuration files.

I'm not sure if this adds to the complexity but I am running both services thru xampp (with tomcat being a xampp add-on) for portability purposes.

I know that I can just stop my Apache service whenever I am working on JSP but hey this is an oppurtunity to try something new and I just can't let it slip. Further, it would really be convenient for both services to just run automatically on startup which would really increase my productivity as I won't have to manually switch between services when needed.

Hope there's someone on SO who rode the same boat.

edit: Tomcat Version is 6.0.20 Httpd Version is 2.2.14

Bor*_*lid 8

  • 让Tomcat在80以外的端口上侦听
  • 按照指南设置mod_proxy,将某个位置的请求重定向到Tomcat,例如这个.

如果您真的只是测试,请跳过第二步,只需通过Tomcat的其他端口访问服务器.

编辑:有关设置mod_proxy_ajp的信息,请参阅http://httpd.apache.org/docs/2.2/mod/mod_proxy_ajp.html.