0

What is the correct way for deploying an Java web app on Tomcat via the Admin / Mgmt interface and have it be the root application and be hosted on port 80?

By default I'm getting /myapp-0.1 and port 8080 ?

Do most shops use Apache with reverse proxy in front of their Java app servers? So to the end user they see the app being served from / and port 80?

Don't have a lot of history with Java so the purpose / intention of the 8080 and subdirectories is new to me. Thanks.

Tyndall
  • 591
  • 1
  • 7
  • 18

2 Answers2

4

Q> What is the correct way for deploying an Java web app on Tomcat via the Admin / Mgmt interface and have it be the root application?
A> Look at https://stackoverflow.com/questions/715506/tomcat-6-how-to-change-the-root-application

Q> hosted on port 80?
A> Change the relevant Connector property in conf/server.xml. Remember, running on port 80 will require root privileges, at least on Unix servers. My approach to that is to let it run on upper port and create a relevant set of iptables rules so this becomes transparent.

Q> Do most shops use Apache with reverse proxy in front of their Java app servers?
A> Some do, some don't. My personal approach is not to, unless you really need (yet another source of mistakes, runtime errors and pain). Tomcat is stable & reliable enough to sit at the frontend.

mindas
  • 238
  • 2
  • 6
  • mindas, I like your answer (+1) and agree that "Tomcat is stable & reliable enough to sit at the frontend" - but what do you do for those (like me) that need pages up while our app + tomcat is down for maintenance? That's why we front with Apache. –  Jun 06 '11 at 21:35
  • You can solve this problem in many different ways, including but not limited to DNAT where DNAT is done towards Tomcat and during maintenance you just reconfigure the firewall to point to a "temporary" IP. Or if you can afford the external IP, you could do the same without DNAT but with a simple static routing rule. Thanks for the upvote BTW. – mindas Jun 06 '11 at 21:38
  • Awesome info. Thanks +1 and answer. Where do you control what the server will respond to? I can hit it by IP address but not by domain name. – Tyndall Jun 08 '11 at 18:17
  • http://tomcat.apache.org/tomcat-6.0-doc/config/host.html#Host_Name_Aliases – mindas Jun 09 '11 at 08:32
1

You would need to deploy it as ROOT.war to make it the default application.

In order to make it listen on port 80 you need to change the tomcat config.xml - I'd advise looking at the documentation for it.

In general if its publicly facing however, you probably want to front end tomcat with another server like apache-httpd.

BZ.
  • 295
  • 1
  • 3
  • 8