Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Jun 7 '11 at 6:34

This question came from our site for professional and enthusiast programmers.

add comment

2 Answers

up vote 4 down vote accepted

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 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.

share|improve this answer
    
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. –  Stephen P Jun 6 '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 6 '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 8 '11 at 18:17
    
add comment

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.

share|improve this answer
    
Also good advice. Thanks. +1 –  Tyndall Jun 8 '11 at 18:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.