aspose file tools*
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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
Author

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 http://www.myapp.com/ 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.

Thanks!
Aaron
[ 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 mod_jk.so or mod_jk.dll (depending upon your platform) and place it in your /modules/ folder of Apache
(http://www.uniontransit.com/apache/tomcat/tomcat-connectors/jk/binaries/)
3. Put in a couple of lines in the workers.properties file of your Tomcat installation.
4. Put in the attribute "jvmRoute" in your Tomcat's server.xml file

You can refer to this site: [http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html]

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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Trying to set http://localhost to load one tomcat project?