File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to change Context

 
Ram Bu
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 405
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@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).
 
Craig Jackson
Ranch Hand
Posts: 405
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 55
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 55
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 214
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lewin, thanks for the explanation. That makes perfect sense.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic