开发者

Apache HTTP Server and Tomcat on one machine

Is it possible to run both servers on one ma开发者_高级运维chine? I need them to be accessible on port 80.


You have to deploy an app (copy app.war to jetty/webapps).

Enable Apache mods:

  • proxy,
  • proxy_http.

In httpd.conf, you should add:

<VirtualHost *:80>
        ServerName domain.com
        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>
        ProxyPreserveHost On
        ProxyPass / http://domain.com:8080/app/
        ProxyPassReverse / http://domain.com:8080/app/
</VirtualHost>


Yes it is and many people (including me) do it all the time. You cannot bind them both on the same port though. Tomcat will usually listen on http port 8080 which you can proxy via apache to 80 using mod_proxy. Another way is to not use http for tomcat but enable the AJP protocol which you'll expose via mod_jk into the apache's 80 port.


You can also run both servers on port 80, bound to different IPs - if you have more than one.

I'd prefer mod_proxy.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜