• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Deploying WAR file in Tomcat (Configuring to deploy it in a domain)

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all thank you to read me and try to help me!

I'm working for the first time with Tomcat 9. I have a WAR file of my project and I want to deploy it in my domain. But I'm having some problems. I have been looking for different tutorials and reading here differents solutions but I cant get one that works for me.

I can deploy my WAR file in http://localhost:8080/myProjectMed/ but I would like to deploy it in my domain: www.getInfo.ue.com/spyInv (example URL) ... How can I do this with Tomcat 9?

Thank you guys
 
Bartender
Posts: 21004
128
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, Jose!

Technically, you already did deploy it in a domain: localhost.localdomain, which exists on just about every machine that runs TCP/IP. But you want it visible on an external domain as well.

There are a couple of things that have to be done here. First, you probably want to get rid of the ":8080" in your URL. But that's more complicated than you'd think. Doman Name Services (DNS) is a map of domain names linked with IP addresses. But 8080 is a port, and DNS doesn't keep port numbers (a domain often serves up multiple ports, depending on the service and protocol being used). So you either have to make Tomcat serve on the default port for the HTTP protocol (port 80) or you have to connect Tomcat to something that can.

Port 80 is in the "magic" range of port IDs that cannot be uses by unprivileged applications, so you have 2 options here. One is to run the Tomcat server under a priviliged account - which is a security risk, and the other is to employ what's known as a reverse proxy server.  There are quite a few servers that can safely listen on port 80 and forward to Tomcat. Among them are Apache HTTPD, Nginx, and Microsoft IIS. A Reverse Proxy is a good thing to have for a large shop, since it can serve as the target for all the shop's webapps, not just the Tomcat cones. Incidentally, people will often simply say "Proxy Server" here, but a true Proxy Server works in the opposite direction. As long as you know which way things are going, it won't matter too much.

In a proxy server, you define Virtual Hosts, and that means that we can have http://www.coderanch.com, http://www.javaranch.com and other domains all proxying for the same backend Tomcat server. The host mappings can include Context paths as well, so that we can do things like have multiple apps in a Tomcat server and proxy http://www.coderanch.com to localhost:9080/javaranch and http://www.permies.com to localhost:9080/permies. And even http://www.getInfo.ue.com/spyInv to localhost:9080/myProjectMed. Note that the backend tunnel uses port 9080, not 8080. The tunnel protocol is different than http and https, so Tomcat has a different port for it.
 
Jose Chovi
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Holloway wrote:Welcome to the Ranch, Jose!

Technically, you already did deploy it in a domain: localhost.localdomain, which exists on just about every machine that runs TCP/IP. But you want it visible on an external domain as well.

There are a couple of things that have to be done here. First, you probably want to get rid of the ":8080" in your URL. But that's more complicated than you'd think. Doman Name Services (DNS) is a map of domain names linked with IP addresses. But 8080 is a port, and DNS doesn't keep port numbers (a domain often serves up multiple ports, depending on the service and protocol being used). So you either have to make Tomcat serve on the default port for the HTTP protocol (port 80) or you have to connect Tomcat to something that can.

Port 80 is in the "magic" range of port IDs that cannot be uses by unprivileged applications, so you have 2 options here. One is to run the Tomcat server under a priviliged account - which is a security risk, and the other is to employ what's known as a reverse proxy server.  There are quite a few servers that can safely listen on port 80 and forward to Tomcat. Among them are Apache HTTPD, Nginx, and Microsoft IIS. A Reverse Proxy is a good thing to have for a large shop, since it can serve as the target for all the shop's webapps, not just the Tomcat cones. Incidentally, people will often simply say "Proxy Server" here, but a true Proxy Server works in the opposite direction. As long as you know which way things are going, it won't matter too much.

In a proxy server, you define Virtual Hosts, and that means that we can have http://www.coderanch.com, http://www.javaranch.com and other domains all proxying for the same backend Tomcat server. The host mappings can include Context paths as well, so that we can do things like have multiple apps in a Tomcat server and proxy http://www.coderanch.com to localhost:9080/javaranch and http://www.permies.com to localhost:9080/permies. And even http://www.getInfo.ue.com/spyInv to localhost:9080/myProjectMed. Note that the backend tunnel uses port 9080, not 8080. The tunnel protocol is different than http and https, so Tomcat has a different port for it.



Thank you Tim for your time and your help!

I have never deploy it in a external domain. So my options now are:

1.- Change tomcat to listen on port 80.
2.- Choose one of the options that you told me.

Is an example project so I don't have to complicate myself so much. So what do you recommend me?
Do you know some tutorial that can help me?

Thank you so much again
 
Jose Chovi
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anybody in the ranch?
 
You totally ruined the moon. You're gonna hafta pay for that you know. This tiny ad agrees:
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!