*
The moose likes Tomcat and the fly likes How do you set up Tomcat as a web server? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "How do you set up Tomcat as a web server?" Watch "How do you set up Tomcat as a web server?" New topic
Author

How do you set up Tomcat as a web server?

Andy Lin
Greenhorn

Joined: Nov 10, 2010
Posts: 6
Hi, I have created a MySQL database and some pages using JSP and HTML. I also used some java as well. I can access this through localhost:8080 using Tomcat right now. The website is for personal uses, so the database is small. Performance is really not an issue. I am using Tomcat 5.5.30. I am running this in windows 7 64bit version.

I just want to be able to run this as a public website to use in conjunction with a resume. I want to run this on my machine that I use on a day-to-day basis because it's light enough that it shouldn't be too bad, or so I just assume. I tried looking it up, and some older information seems to suggest that Tomcat needs to be paired with Apache HTTP web server or IIS. I have also read some other information that says you can use Tomcat alone to host the site as a web server. I am not clear which way it really is...

I would really like to only work with Tomcat if that's possible. I got free hosting service and name from DynDNS(I don't mean to advertise this. I can edit this out if need be). I'm just not sure how to configure Tomcat to connect to this hostname or service to be open to the public. I know how to forward ports if that's necessary on my router. I read somewhere I should change the port from 8080 to 80. Will I need to forward port 80 then on my router?

From what I have gathered so far, is it just enough to configure the server.xml alone? Exactly what do I have to change on there to get it to connect to my host name and service. I have never hosted a website before, so I am a complete newbie on this. If I could get some instruction or tips on this, I'd really appreciate it.

Thank you very much
Joachim Rohde
Ranch Hand

Joined: Nov 27, 2006
Posts: 423

1.) You can run Tomcat stand-alone. No need for anything else.
2.) Yes, you should change your port (in server.xml) to 80. Else everybody else needs to specify the port (e.g. instead of www.domain.com they have to type www.domain.com:8080)
3.) Port-forwarding must be enabled in your router.
4.) DynDNS offers an update-client (http://www.dyndns.com/support/clients/windows.html) which takes care, that your dynamic IP is known at DynDNS (after reboot, etc.).

I think that's all. I'm using DynDNS myself with a Linux machine and it was quite simple to set it up.
Andy Lin
Greenhorn

Joined: Nov 10, 2010
Posts: 6
Thank you for the response! Really appreciate it! I think all that's left is for me to forward the port, and I should be good after using the updater and changing the port from 8080 to 80 in tomcat's server.xml.

I didn't think about this before, but will this affect my security by forwarding port 80 on my router with this set up of tomcat and mysql? If I am fine, will it affect the other people in my house using this router? I've forwarded a port before, but I don't remember if I can specify a certain IP or mac address that would require this or if all machines accessing the router would have port 80 forwarded. Will there be security risks if other people have them forwarded on the router that don't? Will I want to open the 80 on TCP or UDP or both on the router?

I have installed the updater. When I try to connect, it says the connection has timed out. I did forget to set the default page. How do I set the default page the user will see?
I also set the port forwarding from 8080 to 80 for the moment. It seems I'm not able to access it for some reason. I'm going through a D-Link dir655 if this helps. Is there anything else I need to change? I just changed port forwarding and the connector port number in server.xml. I was also wondering if there's a sequence of steps to evaluate which part is not working. I'm wondering if it's the router or the way tomcat is configured, or not configured. Is there an easy way to find out if the ISP blocks web hosting on port 80 or in general? I don't have account info readily and that's not part of the responsibility delegated to me in my living arrangements

Thank you again
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do you set up Tomcat as a web server?
 
Similar Threads
Visibility of web site on port 8088
getLocalPort()
HELP!!!! - Website hosting at Home Problems.. :(
Configure Apache to forward request to Tomcat
NX: URLy Bird 1.3.1 Suncertify.properties