Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Web hosting on tomcat+windows

 
Greenhorn
Posts: 12
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am a newbie for web hosting. I wanted to host my first website on shared tomcat on windows but always need to append the war file name with my domain name as domain.com/war-file-name.
I want to get my pages only by entering domain.com.
Please let me know how to achieve this.

Thanks in advance.
 
Sheriff
Posts: 67592
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make your application the ROOT application, or front Tomcat with Apache configured to route to the web app.
 
Saloon Keeper
Posts: 24336
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's not "domain.com/war-file-name". It's servername/contextName.

The servername is the fully-qualified domain name (FQDN) of the server or something that can be converted into a FQDN. For example, "coderanch.com" will be attempted as "www.coderanch.com", where "www" is the actual name of the server within the coderanch.com domain. Alternatively, you could simply supply the IP address of that server, as the first thing that your web client is going to do is look up www.coderanch.com to get the IP address. That's how TCP/IP knows where to send the request.

The contextName is the logical name that distinguishes one webapp within a Tomcat instance from all the other webapps that it is running so that when the server receives the request, Tomcat will know which app to route the request to. If you just dump a WAR into the TOMCAT_HOME/webapps directory, a context will be created automatically and given the name of the WAR, but there are other options.

Bear is referring to replacing the root context - "/" with your webapp. I'm not a big fan of that, actually.

One thing I didn't mention is that "servername/contextName" is not sufficient for the web to talk to Tomcat. Tomcat runs (as distributed) listening on TCP/IP port 8080. DNS, however, only looks up IP addresses. If you send a web request and don't include the port number (":8080"), then the web client will target the server's port 80. Most OS's require elevated security privileges to listen on port 80. Thus, if you re-configure Tomcat to listen on port 80, you have to make it run as a privileged user, and that's a security risk. Most industrial-grade web server systems will incorporate a proxy such as Apache or IIS to listen on port 80 and forward the requests to Tomcat in order to avoid that risk. The proxying mechanism can also add in the context name, eliminating the need to deploy the webapp under the root context.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic