wood burning stoves 2.0*
The moose likes Tomcat and the fly likes How to change Context Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "How to change Context " Watch "How to change Context " New topic
Author

How to change Context

Ram Bu
Greenhorn

Joined: Jul 15, 2005
Posts: 13
Hi,

I am a newbie to Apache/Tomcat. Can someone guide me to achieve the following.

Instead of typing http://localhost:8080/, I want to type the web server name like http://webserver/ and this should take me to default web page.

I tried couple context name changes, but couldn't get them to work.

Any help is greatly appreciated.

Thanks,
R
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
If you are trying to configure Apache and Tomcat together, you will need to download and install/configure the mod_jk connector. Depending on your operation system, there may already be a binary version, otherwise you may have to download the source and compile it.
The Apache Jakarta Tomcat Connector

If you are trying to configure Tomcat as a stand alone server. I believe you will have to modify the server.xml and change the port from 8080 to 80, beacause by default Tomcat listens to port 8080.
[ August 01, 2005: Message edited by: Craig Jackson ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41592
    
  55
@Craig: Is configuring Tomcat to listen on port 80 as easy as that? I seem to remember from years ago that it was essentially impossible to do that (unless you were actually running Tomcat as root).


Ping & DNS - my free Android networking tools app
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
To be honest, I am not exactly sure, I am running the Apache/Tomcat collaboration. I have not tried to run Tomcat as a stand alone server, but I know that there are several members who are and can elaborate more on the subject.
Jim Babcock
Ranch Hand

Joined: Dec 03, 2004
Posts: 55
Running on port 80, which is the default http port and necessary to not have a port number included in the URL, means running the server as root on UNIX systems. Any process running on any port below port 1000 (I think) has to be start by root as a security check.
Jim Babcock
Ranch Hand

Joined: Dec 03, 2004
Posts: 55
Instead of typing http://localhost:8080/, I want to type the web server name like http://webserver/ and this should take me to default web page.


BTW, using "webserver" vs "localhost" is a DNS matter. localhost is (most likely) hardcoded to 127.0.0.1 in etc/hosts (or C:\WINDOWS\system32\drivers\etc\hosts). For your machine to be know on the web as whatever.net, you need someone with a DNS server to publish the name and link it to your IP address. Most companies and universities have the ability to do this, but if you are sitting at home with a cable modem, you'll have to someone to do it for you. There are some free services out there, do a google search. If you don't have a static IP, you'll need to software running that will dynamically monitor it and update the service.

That's probably way more simplified than you needed, but I wasn't sure...

Jimbus
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41592
    
  55

Running on port 80, which is the default http port and necessary to not have a port number included in the URL, means running the server as root on UNIX systems. Any process running on any port below port 1000 (I think) has to be start by root as a security check.


The privileged ports are the ones below 1024, but it can't be that running servers on those requires root privileges, can it? Surely not all web servers on this world are running as root?
That's what I was getting at, that you can run Apache on port 80 w/o being root, but you can't run Tomcat on port 80 w/o being root.
Lewin Chan
Ranch Hand

Joined: Oct 10, 2001
Posts: 214
Ulf,

Apache is started with root privileges i.e. the listener on port 80 has super-user privileges.

Before it processes a request it uses suexec to start up a thread that is non-privileged (usually httpd) to handle that request.

Most daemons who listen on < 1024 on Unix style machines do much the same. I don't believe that you can do that in java, so tomcat listening on port 80 will have to run as root.


I have no java certifications. This makes me a bad programmer. Ignore my post.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41592
    
  55
Lewin, thanks for the explanation. That makes perfect sense.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to change Context