mobot
asked on
Running Apache Tomcat and Apache HTTPD on port 80 simultaneously.
I want http://server.mydomain.org to take me straight to the java app.
What do I need to do to make that happen?
http://server.mydomain.org takes me to the Tomcat GUI.
http://server.mydomain.org/javaapp takes me to the java app.
i'm using this conf file. It's the only site enabled.
<VirtualHost server.mydomain.org>
ServerName server.mydomain.org
ServerAlias server.mydomain.org
ProxyRequests off
ProxyPreserveHost on
ProxyPass / http://server.mydomain.org:8080/
ProxyPassReverse / http://server.mydomain.org:8080/
</VirtualHost>
The usual stuff. This is not enabled.
000-default
<VirtualHost *80>
#ServerName www.example.com commented out.
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR]/error.lo g
CustomLog $[APACHE_LOG_DIR]/access.l og combined
</VirtualHOst>
#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.
What do I need to do to make that happen?
http://server.mydomain.org takes me to the Tomcat GUI.
http://server.mydomain.org/javaapp takes me to the java app.
i'm using this conf file. It's the only site enabled.
<VirtualHost server.mydomain.org>
ServerName server.mydomain.org
ServerAlias server.mydomain.org
ProxyRequests off
ProxyPreserveHost on
ProxyPass / http://server.mydomain.org:8080/
ProxyPassReverse / http://server.mydomain.org:8080/
</VirtualHost>
The usual stuff. This is not enabled.
000-default
<VirtualHost *80>
#ServerName www.example.com commented out.
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR]/error.lo
CustomLog $[APACHE_LOG_DIR]/access.l
</VirtualHOst>
#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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@mccarl
My path /opt/tomcat/webapps/javaap p.
I moved /opt/tomcat/webapps/javaap p to /opt/tomcat/webapps/ROOT.
//server.mydomain.org still resolves to the Tomcat GUI
//server.mydomain.org/java app 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.
Suggestions???
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?
My path /opt/tomcat/webapps/javaap
I moved /opt/tomcat/webapps/javaap
//server.mydomain.org still resolves to the Tomcat GUI
//server.mydomain.org/java
I added DocumentRoot /opt/tomcat/webapps/ROOT to the VirtualHost conf file.
That didn't work, it still throws the 404 error.
Suggestions???
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?
ASKER
@David
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.
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.
//server.mydomain.org 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?
ASKER
@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.
ASKER
Thank you.
Tomcat normally runs on port 127.0.0.1:8080 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.