• 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

Webapp URLs without port 8080: mod_jk, binary releases, and Windows 64

 
Ranch Hand
Posts: 106
Hibernate Python MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I'm looking for a way to configure Tomcat 6 so that entering

http://dev.bbstats.tld/
or
http://bbstats.domain.com/

will be equivalent to the default webapp URL

http://localhost:8080/bbstats

I had no luck fiddling with Tomcat so far. I suspect I need mod_jk to do this. Is that correct?

I looked on the Tomcat connectors site, however browsing the binary releases did not reveal any files being named mod_jk-*.so. Where do I find the binary releases (Win64)? I thought they were here:

http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win64/jk-1.2.30/amd64/

...but they aren't. What am I missing?

Karsten
 
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
Tomcat isn't in charge of that.

When you enter a URL such as http://www.mousetech.com/blog your browser extracts the host/domain name part of the URL (www.mousetech.com) and uses the OS name resolution services to convert it to an IP address (216.199.14.18). The exact mechanisms that are used to do this are usually OS configuration options, although among the most common resolvers are included looking in the /etc/hosts file (or its Windows equivalent) and contacting a Domain Name Server (DNS).

Once your browser has done this conversion, it opens a connection to that IP address. If you have included an explicit port ID such as 8080 as part of your URL, the browser will contact that port. Otherwise, the default port ID is used: 80 for http URLs or 443 for https URLs.

Notice that in all of the above cases, the operative word is browser. Not mention of server, much less of Tomcat.

If you have direct control of the client computer(s), you can override their default behaviors as far as domain names go. In fact, you could add an entry to your /etc/hosts to map www.google.com to 127.0.0.1 (localhost) if you wanted. Although you might regret it.

Port numbers, however, are hardwired into the browser, so short of building a custom edition of the browser (and lots of luck doing that with IE!), your only alternative is to supply a server that listens on port 80.

There are several ways to do that. The major-league solution is to use Apache as a proxy plus mod_jk or mod_proxy. You can also use a simple proxy server, such as squid. In Linux, you can even do port remapping at the OS level (iptables). However, most people either use Apache or they modify Tomcat's server.xml file to listen on port 80 instead of its standard port of 8080.

One caveat, however. Port 80 is protected on a lot of OS's. That means that only privileged (root/admin) applications can use it as a listener port. That's a security risk, since the entire Tomcat system must run privileged, and thus, by extension, all the webapps. That's one reason why Apache is popular as a frontend. Apache can be launched as a privileged user app that then downgrades itself to a less privileged status. Tomcat can't do that.
 
reply
    Bookmark Topic Watch Topic
  • New Topic