This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Trying to set http://localhost to load one tomcat project? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Products » Tomcat
Bookmark "Trying to set http://localhost to load one tomcat project?" Watch "Trying to set http://localhost to load one tomcat project?" New topic

Trying to set http://localhost to load one tomcat project?

Aaron Wilt
Ranch Hand

Joined: Sep 26, 2001
Posts: 49
Hi, I'm a real noob when it comes to apache and tomcat configs...

I've got an java app: myapp in myapp.war

I'm running apache 2.2 running on port 80 with mod_rewrite installed
I'm running tomcat 5.5 running on port 8083

I'd like to configure my web/app servers so when I go to http://localhost/ it knows to load http://localhost:8083/myapp from tomcat.

The reason I'm trying to get this done is eventually it's going to be out on the web at and I will want that to load from the tomcat /myapp/ context without changing the URL -- IE I DO NOT want it to just "forward" to a new URL, I'd like it to keep the URL the same but load from /myapp on tomcat.

Will I need mod_rewrite to do this? Is there a way to do this via ProxyPass command?

Also just to clarify, I'd like it to work so that any urls that would normally be http://localhost:8083/myapp/* could be accessed via http://localhost/* -- ie http://localhost/css/mycss.css should be found in http://localhost:8083/myapp/css/mycss.css and my strust2 actions classes should still work at http://localhost/MyAction.action etc.

[ September 02, 2007: Message edited by: Aaron Wilt ]
Anirvan Majumdar
Ranch Hand

Joined: Feb 22, 2005
Posts: 261
Hello Aaron,

You might want to try the mod_jk method instead of the rewrite. That way all you need to do would be:
1. Change/put in a couple of lines in the httpd.conf file
2. Download the or mod_jk.dll (depending upon your platform) and place it in your /modules/ folder of Apache
3. Put in a couple of lines in the file of your Tomcat installation.
4. Put in the attribute "jvmRoute" in your Tomcat's server.xml file

You can refer to this site: []

This is quite a simple way of setting up an Apache web server before your Tomcat. The configuring part is actually easier than it looks.

If you need further assistance post in. Hope this helps!
Have you checked out Aspose?
subject: Trying to set http://localhost to load one tomcat project?
It's not a secret anymore!