• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Tomcat Host configuration

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have Tomcat 8.5 running on Ubuntu 18.4 which host several wars.

Now I have another web server running on that same machine but on different port.
Just like when Apache http server and Tomcat is running on same machine but Apache is main server. In my case Tomcat is main server.

Now I want to set up Tomcat to host the page on the secondary web server so when visitor can access the second server trough Tomcat.
For example http://mydomain.com/otherserver.jsp

I think it has to do something with Host or Virtual configuration in server.xml.

Please check this topic:
https://stackoverflow.com/questions/54250251/deployment-of-a-javafx-application-on-wildfly-11-0-0

Thank you.
Hugo

 
Saloon Keeper
Posts: 22126
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, you're better off using Apache, nginx, or some other standard HTTP server as your "main server".

First of all, those products are designed to be able to do the reverse proxying that is essential to having a primary host and backend hosts. Tomcat, as far as I know, has no such support.

Secondly, running Tomcat on port 80 is a major security problem. Acquiring port 80 - or any port less than 4096 - requires that the application have administrative (root) privileges. Apache and Nginx start as administrative users, but then downshift to non-administrative mode. Tomcat cannot do that, since it's not an OS-independent ("write once/run anywhere") capability.

The technical term you want when you serve multiple domain names such as "x.coderanch.com" and "y.coderanch.com" is Virtual Host. Tomcat can do Virtual Hosts, just like Apache and its friends, but each Virtual Host in Tomcat has the same issues as the primary Tomcat Host.
 
Hugo Larson
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately i'm stuck with Tomcat as master web server and it actually run on 8080 but with iptables traffic is routed from 80 and 443 to 8080 so it works just fine.

I don't want to host multiple domains but the "sub http server" can be on same domain.
Can I use Virtual host to proxy to the sub server?

Thanks.
 
Tim Holloway
Saloon Keeper
Posts: 22126
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I said, Tomcat doesn't do proxying. A VirtualHost simply defines an alternate domain name and set of webapps. The actual web applications for that domain, however, would have to be within the Tomcat server that defined the Virtual Host.

That's different from Apache HTTPD where an Apache Virtual Host can define a tunnel to reverse proxy to other servers (including one or more Tomcats).
 
Hugo Larson
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the advice and information.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic