I did a test over my current web host and then I observed the following tomcat log.
NFO: Deployment of web application archive /media2/xxx/public_html/test2/ROOT.war has finished in 736 ms
Mar 19, 2019 9:52:29 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8138"]
Mar 19, 2019 9:52:29 AM org.apache.catalina.connector.MapperListener findDefaultHost
WARNING: Unknown default host [localhost] for connector [Connector[AJP/1.3-8138]]
Mar 19, 2019 9:52:29 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4585 ms
I am puzzled that the war file is uploaded to test but the deployment shows test2 instead.
It is very common for Tomcat to be proxied by a non-Java webapp server like Apache, Nginx, or IIS, yes.
There are two reasons why this is a good idea.
First, it allows a single web address to handle both Java and non-Java webapps, since a program like Apache can proxy for Tomcat, but Tomcat isn't set up to proxy for Apache.
Secondly, and in many respects, more importantly, this is a more secure solution than exposing Tomcat directly to the Internet.
That's because TCP/IP assigns magical properties to ports less than 4096 - including the http port (80) and https (443). To be able to listen to the "magic" ports, the application has to run as an administrative (root) user. Otherwise the OS will reject the listening request.
Running as root is a serious security risk. You NEVER want to run as root if you don't have to, and ESPECIALLY when you're directly connected to a hostile environment like the Internet.
Apache and its relatives can deal with this, because while they launch as root apps, they change their user identities after they open the port to non-root users. Tomcat cannot do that, because Tomcat is written 100% in Java (write once/run anywhere) and there's no universal way for a Java application to change its OS user ID. In fact, Java isn't even supposed to know if the OS even has user IDs (MS-DOS, for example, did not).
So by configuring Apache as a "reverse proxy", incoming URLs destined for Tomcat can be received by Apache and forwarded via a private tunnel protocol to Tomcat (mod_proxy or mod_jk) and all is happy, if slightly more complicated.
But the Apache and Tomcat servers themselves should be completely separate (don't even have to be on the same machine), so you shouldn't be putting Tomcat application resources in an Apache directory or vice versa.
When it comes to destroying a civilization, gas chambers cannot hold a candle to echo chambers.
Are we home yet? Wait, did we forget the tiny ad?
global solutions you can do in your home or backyard