Running Apache Tomcat and Apache HTTPD on port 80 simultaneously.

mobot used Ask the Experts™
I want to take me straight to the java app.
What do I need to do to make that happen? takes me to the Tomcat GUI. takes me to the java app.

i'm using this conf file.  It's the only site enabled.
ProxyRequests off
ProxyPreserveHost on
ProxyPass /
ProxyPassReverse /

The usual stuff. This is not enabled.
<VirtualHost *80>
#ServerName  commented out.
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR]/error.log
CustomLog $[APACHE_LOG_DIR]/access.log combined

#vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Java 1.8.0
Tomcat 9.0.12
Apache 2.4
Debian 9.5

I have read doc's from Apache, and several from Digital Ocean, and others.
I just don't get it.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
David FavorFractional CTO
Distinguished Expert 2018

Normally what you're asking is setup by default.

Tomcat normally runs on port or some other port and Java Servlet requests are proxied from Apache to Tomcat for handling... so... any HTML file requests serve normally from Apache + any Java file requests are proxied to Tomcat.

Tip: Trying to get all this working from scratch, especially Apache + Tomcat or adding other language support like PHP on top... well.. complex...

Simple way to do this is to start with a Distro which handles all this setup complexity in packaging.

Ubuntu Bionic tends to produce a working Tomcat system by simply installing packages. No mucking about with config files.
IT Business Systems Analyst / Software Developer
Top Expert 2015
Commented: takes me to the Tomcat GUI. takes me to the java app.

If the above is actually working as you say, then I think you are almost there. You just need to get Tomcat to serve the app without the "javaapp" part of the path. There are (at least) a couple of ways to do this, but probably the easiest is to just move the webapp. So wherever your webapp is currently located, it may be in a directory such as ...


Just move everything inside that directory (and subdirectories) into the "ROOT" directory next to the "javaapp" directory, so in the example directory I gave above, it should be...


(The ROOT directory is just another webapp but one that gets served at the root path "/" rather than a named path)



My path /opt/tomcat/webapps/javaapp.
I moved /opt/tomcat/webapps/javaapp to /opt/tomcat/webapps/ROOT.
// still resolves to the Tomcat GUI
// throws a 404 error since I moved the javaapp into ROOT.
I added DocumentRoot /opt/tomcat/webapps/ROOT to the VirtualHost conf file.
That didn't work, it still throws the 404 error.

And thanks for explaining how ROOT works.  
My java app is named xxx-2.3.5.  Would the characters - . being included in the name cause me grief?
OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.



Thanks for cluing me in on that tip.  I didn't know about it.  I'm still pursuing my current approach.  I want to learn how it's done this way.
mccarlIT Business Systems Analyst / Software Developer
Top Expert 2015

// still resolves to the Tomcat GUI

Sorry, probably should have mentioned... maybe the ROOT folder still has existing files (such as index.html, etc) that are being picked up as the "welcome page" before whatever you have set up for you java app. Trying removing (or just moving) as such files out of ROOT that aren't part of you app.

If this still doesn't work, are you happy to post some files? Probably need to look at you Apache conf files, Tomcat server.xml, context.xml, web.xml, and maybe a directory listing of you web app?


@mccarl - i'm still digging at this as I get time.  right now i'm still getting the 404. there was an index.jsp in the ROOT dir.  I moved it to a bakup folder. but no joy. thanks again.


Thank you.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial