What is Apache Tomcat and can I use it as a web server?

Started by
2 comments, last by alvaro 12 years, 2 months ago
So today i felt like writing servlets on windows 7(x86).
A tutorial on writing servlets gave me instructions on how to setup Apache tomcat in eclipse so i can begin writing.
My problem is that i dont fully understand what apache tomcat is used for.
I spent hours trying to change the hostname:"Localhost" to something else because i convinced myself that it could be used as a web server(i pretty much want to make a website).
Can other people connect to this server or is it just for servlets and jsps?
If i can use appache tomcat as a webserver, how would i do that?

Right now though, all i really want to do is change the hostname:"localhost" on port 8080, to something else while still being able to connect to the server.
Advertisement

My problem is that i dont fully understand what apache tomcat is used for.

"Apache Tomcat is an open source web server and servlet container"


I spent hours trying to change the hostname:"Localhost" to something else because i convinced myself that it could be used as a web server(i pretty much want to make a website).

localhost is just a networking word that means "this computer." You can try 127.0.0.1 if you really don't like localhost. Any computer you're on, localhost/127.0.0.1 mean "this computer." So if you want Tomcat to handle things for "this computer," localhost is a good idea. But people can't connect to your computer by typing in "localhost' or "127.0.0.1" If they know your machine's network name (or LAN IP), they can use that. Note that this network name is only usable by those on your LAN, and someone from the outside world (like me) can't connect to your computer through that name.


Can other people connect to this server or is it just for servlets and jsps?

Depends on how you set up your machine. You can't just download a server application and tell people to connect to your computer. The server application (i.e. Apache Tomcat) just handles incoming connection requests, more or less. But it doesn't tell people how to connect to your computer. In order to connect to your computer from the outside world, people need to know your IP address. If it's just for your LAN, your computer's network name will be good enough.

It's like this: the IP address is your address, and the server application is the butler at your house. When people come to your house, the butler is there to handle them. But just having the butler (server application) isn't enough, because you need people to know your address (IP address) in order to find your house.


Right now though, all i really want to do is change the hostname:"localhost" on port 8080, to something else while still being able to connect to the server.

And what would you change it to?
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
Setting up and configuring Apache Tomcat is almost a profession in itself! In most cases, it is probably far to heavy weight for what you are wanting to do ( especially if this is for a game server ).


What Cornstalks said is right(ish).


Basically it goes like this:

Apache is a foundation ( like Mozilla ) as well as the name of their flagship project ( a webserver ).

Apache Tomcat is a JSP ( server side Java ) server, also made by the Apache Foundation. Tomcat is generally installed on Apache ( the webserver ), but can also be installed on IIS or other web servers.

Think about it this way.

Apache = IIS webserver
Apache Tomcat == ASP.NET




Simply put, it is not a trivial subject. If you are looking at creating a server side component for a game, I highly suggest you check out Node.JS. Although "light weight" servers can easily be created in C# or Python in just a dozen or so lines of code. A full application server is probably massive overkill, unless you are doing a lot of database work, etc.

Right now though, all i really want to do is change the hostname:"localhost" on port 8080, to something else while still being able to connect to the server.


You can change your hosts file to make some other name map to 127.0.0.1 . That's probably the easiest solution.

This topic is closed to new replies.

Advertisement