aspose file tools*
The moose likes Tomcat and the fly likes turning my localhost into a web site Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "turning my localhost into a web site" Watch "turning my localhost into a web site" New topic
Author

turning my localhost into a web site

Joseph Sweet
Ranch Hand

Joined: Jan 29, 2005
Posts: 327
Hi everyone,

Does somebody have a clue how to turn my tomcat localhost into a regular web site. I mean that clients from the outside could access my html/jsp/servlets.

I could not find any tutorial on that.

Please share your info.
[ February 07, 2005: Message edited by: Joseph Sweet ]

We must know, we will know. -- David Hilbert
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12806
    
    5
Do you mean that you want your Tomcat to be permanently connected to the Internet, with a fixed address? If so the first question is - what is your present Internet connection? That is - what kind of connection is it?
Bill
Joseph Sweet
Ranch Hand

Joined: Jan 29, 2005
Posts: 327
yes I want my tomcat to be permanently connected to the Internet. Well, as long as I do not turn off my local pc.

Fixed IP address? Well I guess my IP address is not fixed. It changes everytime I reconnect to the web. How do I make it fixed?

I want people to be able to access my localhost as I do. And run my JSP/Servlets etc. In other words, I want to turn my tomcat into a web site.

I am connected to the Internet through ADSL.
[ February 07, 2005: Message edited by: Joseph Sweet ]
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
To get a fixed IP address you have to go through your ISP and usually costs quite a bit. You can look into 'dynamic dns', that is probably a better solution for you. Usually if you are going to set up a site you would want to leave your system running 24/7 so people can actually see it when they want to. You will probably want to register a domain name, I got mine at godaddy DOT com.

The only thing I don't know how to do is tell my registrar (godaddy in my case) to point my www address to my IP address. I would imagine they have something setup, and this is something I have been planning, but I haven't gotten to that point yet so I haven't looked it up.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

These guys can provide dynamic DNS

http://www.dynip.com/


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Joseph Sweet
Ranch Hand

Joined: Jan 29, 2005
Posts: 327
Thank you friends.

I see there are also free dns providers around:
http://www.thefreecountry.com/webmaster/freedns.shtml

What shoud I do on my pc in order to let other people get connected to my tomcat localhost?

Is starting up tomcat enough?
[ February 07, 2005: Message edited by: Joseph Sweet ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

You might want to change the port to 80 so your users don't have to type a port number every time.

TOMCAT_HOME/conf/server.xml (search for 8080)
Joseph Sweet
Ranch Hand

Joined: Jan 29, 2005
Posts: 327
Thank you.

How can I restrict clients so they could access only certain directories in my computer. Say TOMCAT_HOME/webapps/mydomain/.

Could someone harm my computer if I let them upload only *.doc files?
[ February 07, 2005: Message edited by: Joseph Sweet ]
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
You need to be very careful if you are going to allow file upload. A doc file can do just about anything it want's to your system if you open it and allow macros to run.

Exposing your system to the web and running a web server automatically puts you at some risk. You absolutly must have a firewall up (zone alarm), and an antivirus running (AGV is my personal favorite). I would tend to want to have the 'web server' a seperate machine. If that is not possible you will want to get a book on Tomcat security. To my understanding the default security on a Tomcat install is fairly secure, but I'm always a little paranoid about exposing my system.
Joseph Sweet
Ranch Hand

Joined: Jan 29, 2005
Posts: 327
Thank you for your reply.

I think letting other people upload doc files to my computer is the safest part as I am not going to open them. I have built an automatic resume' mailiing system (so I let them upload their resume) and thought to host it on my pc as I do not have a Java hosting account.

But since this is my only pc and do not want it to crush...

Does any one know of a Java hosting service that offers all the good Java stuff, and is affordable too?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12806
    
    5
One of the security things to watch out for - the default web.xml probably has the init-param "listings" setting for the default servlet set to "true". This lets people browse directories - set it to false.
Bill
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
As far as setting up a webserver, I would recommend that you buy a second hand PC to use only as your server. Also it makes life so much more easier if you obtain a static IP address from IP provider. They are usually less than $18 dollars a month. That way if your IP address ever changes you want have to keep changing your registration information on your domain name.

But I found this website very helpful, when I started to build my first webserver. It should answer just about all of your questions on what you might need and what to look for if you decide to host your own website.

DSL/Cable Webserver
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: turning my localhost into a web site