Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

configuring domain name to point to tomcat server

Status
Not open for further replies.

dognobbler

Programmer
Jul 4, 2003
46
GB
I have a tomcat server running on my home pc, which is running on a static IP and so is visible on the internet.

I have a domain name which I would like to configure to point to a particular application running on tomcat.

I am able to point configure my domain name to point to the IP address of my home computer.

What I would like to know now is what I need to do to make the domain name point to a particular application within tomcat.

Thanks

Andy
 
Andy,

It should be similar to the url you would use to access the application from home i.e. .

So if you access the app at home using:

you would access it externally using:

Assuming you have a firewall, you will have to open port 8080 - is that the problem perhaps?

Nick.
 
Andy,

If you set the context to /myapp you need to append this to the domain to get to it. If you set the context for myapp to the "root context" of / ipaddress:8080 will go straight there. You obviously can't have two applications both at / (assume you have only one).

If it's the 8080 you want to get rid of, you can run Tomcat on the default port of 80. You can only do this if nothing else is running on 80. If you enter just the ipaddress into your browser, and get a page not found error, port 80 is probably free.

In Tomcat's conf/server.xml file, change the port for the basic connector from the standard 8080 to 80 and restart Tomcat.

If you do both of the above, should take you straight to myapp.

Nick.
 
I am sorry but I do not understand what you mean by "setting the context". Could you explain?

Thanks

Andy
 
Remembering that Tomcat can serve multiple applications from a single server, it can only service a request if it understands the "context" of the request.
For example, if it is serving two applications, and you ask it to give you the home page index.jsp, it can only do that if it understands which of the two applications you mean. You have to set the context of your request i.e. do you mean /myapp/index.jsp or /anotherapp/index.jsp ?

The context in your address is therefore the /myapp bit after the server:port bit. It's what tells tomcat which application to serve.

The context usually mirrors the location of the application, but it doen't have to. All of the following are valid possibilities (although not at the same time):
- context /myapp associated with application at %CATALINA_HOME%\webapps\myapp
- context /myapp associated with application at %CATALINA_HOME%\webapps\anotherapp
- context /xyz associated with application at %CATALINA_HOME%\webapps\myapp
- context / associated with application at %CATALINA_HOME%\webapps\myapp

If you set the context of myapp to / as in the last example, will take you to your application, which is what I think you want(?).

You set the context when you deploy your application, and can change it afterwards. How you set and change it depends on how you deployed it, and you presumably know that.
 
I understand what you mean. However I am afraid that I did not set any context when I deployed my application. In fact I may not actually have deployed my application. All I have done is create an application under the following address




Would you mind telling me how I deploy the applciation and set the context or point me in the direction of further information. Thank you.

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top