• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Basic Tomcat Question: Change Port 8080?

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have Tomcat installed on a shared sever. If I go to mysite.com/test.jsp it works. It also works if I go to mysite.com:8080/test.jsp. When I installed JForum, it uses the web.config file to map URLs to servlets. Those mappings quit working when I leave off the port 8080. Is it possible to get them to work on port 80 (Apache is also installed) without having to do a mod_proxy, or does does the JSP files work but the servlets do not?
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In conf folder there will be a server.xml file
you need to change port there. you will find it if you look into it.
 
Jim Rosenberg
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Apache is also installed, and it's on port 80. Isn't changing the port number by itself not the solution (plus it won't even work since that's Apache's port)? I thought I had to do something where Apache takes the requests, but knows it's for Tomcat, the same way the JSPs work.
 
rewati raman
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tomcat comes with apache. Apache will take the request and forward it to tomcat if tomcat is needed. why do you need another apache.
I think stopping apache and restating tomcat will do your work.
 
Jim Rosenberg
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's on a shared server. Apache is for the rest of the sites on that server, and then Tomcat is for 2 sites. I was told running Tomcat for all of them would be too resource intense, especially for those that don't actually need Tomcat.
 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jim,

Not that it matters much at this point, but what version of tomcat are you using?

If all you want to do is run JSPs, then you only need Tomcat. You don't necessarily need Apache + Tomcat.

In Tomcat's serverl.xml, you can change the port of Tomcat from 8080, to just 80. You can't have Apache and Tomcat listening on the same port, so if you want to run JSPs on port 80 using Tomcat, without configuring anything else for Apache, then turn off Apache.

Tomcat and Apache are two different products, you sound like you already know this, but just wanted to make you aware of that.

Who told you running Tomcat for HTTP would be too resource intensive? Did you read that somewhere on http://tomcat.apache.org or is that second hand info?
 
Jim Rosenberg
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using Tomcat 5.5.28. I actually want to run servlets on one site, but am not too thrilled about redirecting all incoming requests to port 8080. The server uses cPanel, and Tomcat was installed with EasyApache. cPanel has an "Install Servlets" option for domains. When I choose a domain, it shows a warning message about servlets being resource intensive, and that I can only install them on about 100 domains.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you type a URL into a browser's navigation bar - or use any other URL-based reference to a website for that matter - the URL is parsed into its components. One of those components is the server/domain name. This name is then looked up in the "telephone book" of the Internet: DNS.

DNS entries only contain IP addresses, not port numbers. So if you make a request to a a server, the port name selected will be 80 for HTTP requests or 443 if it's an HTTPS request. If you want any other port, you must explicitly ask for it using the :port#" part of the URL. That's a function of the client (your browser), regardless of how the server was configured.

In general, complex websites will use something like Apache as the master dispatcher for all incoming URL requests. Apache will then analyze the URL and send it to a suitable handler. For Tomcat requests, that means that it will route the request via mod_proxy or something similar from the Apache server to the Tomcat server.

Although it might seem simpler to route directly to Tomcat, there are reasons why the Apache-to-Tomcat approach is preferable.

One of them is port conflicts. Since only one app can hold a port for listening, if Apache holds Port 80, Tomcat can't have it.

Another is security. On many systems, only root applications can open ports numbered below 4096. Apache can start as root and then switch to a less-privileged identity to protect itself and the system, allowing it the benefits of being able to listen on port 80 yet run unprivileged. Tomcat cannot do that. It would have to shed its write-once/run-anywhere abilities to do so, since OS-specific functions are required to do that.

Servlets ARE resource-intensive compared to say, PHP. However, bypassing Apache won't make them any less resource intensive. The whole point of servlets - and J2EE - is to be able to do resource-intensive processing.
 
Jim Rosenberg
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After poking around and Googling stuff, I found that when Tomcat was installed, it installed JkMount. When servlets are added to a domain, the /*.jsp rule is added to JkMount. That's why JSPs work without the port, but the servlets do not. I added the jforum directory, and now everything is working.
 
Goodbye moon men. Hello tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic