1

I want to practice web programming on my Ubuntu virtual machine. I want to learn both server side web development using Java/J2EE and client side coding (HTML/CSS/JavaScript) .

I heard that we need Apache HTTP for serving static pages and Apache Tomcat for running Java servlets pages.

I want to install both of them on the same machine. Can they both co-exist on the same server? If yes, do I need to take any precaution?

  • Yes. And no, no special precaution I would be aware of. Our website runs with Apache Web Server and at some time we were using Apache Solr for search which required Tomcat to run. No problems whatsoever. (btw: question is most likely off topic on this site and will be closed). ServerFault would have been a better place to ask (maybe, I don't know their rules). – thorsten müller Apr 19 '16 at 10:33
  • 3
    Although thorsten already said it, I have to write a comment here to cast the first close vote, so: What use cases a specific tool supports is generally off-topic here, and is better suited either to an SE about that kind of tool (which might be ServerFault, but I don't know their rules either) or to the official support forums for those tools. – Ixrec Apr 19 '16 at 10:52
  • You can also serve static pages with Apache Tomcat, if so desired. Just place the static content at /var/lib/tomcat8/webapps/my-static-content (or $CATALINA_BASE/my-static-content if you have tomcat installed somewhere else), and visit localhost:8080/my-static-content in your browser. – J. Lenthe Apr 19 '16 at 18:07
1

Absolutely, there is no reason they can not run on the same server. By default the web server runs on port 80 and tomcat runs on port 8080 so there are no port conflicts.

I have configured a setup where a static/promo website is served by apache2 and then once the user logs in to the site they will be directed to www.bla.com/app which apache2 directs through to tomcat.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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