It's not a secret anymore!*
The moose likes Tomcat and the fly likes Virtual Hosts with Tomcat/Apache Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Virtual Hosts with Tomcat/Apache" Watch "Virtual Hosts with Tomcat/Apache" New topic

Virtual Hosts with Tomcat/Apache

Bill Leighton

Joined: Oct 12, 2004
Posts: 3
I have been searching for an answer for this, but nothing seems to be just what I need, or else I am doing it completly wrong, which is much more likely.

Anyway, I want to have one folder on my linux machine, /var/www/html/work/testjsp that will keep all of my html and jsp files.

I want to get to this by using the URL, which is in my DNS.

I have Apache configured with Virtual hosts, did that first and it worked fine with an index.html or index.php file in the root.

Then I tried to configure Tomcat to use the same path so if I have index.jsp in the root, that would work as well. But when I try that, I am either getting file not found, or if I change a few things it was redirecting back to the default index.jsp in the webapps directory (however, I think I figured that out, I was using Name and not name in my Host directive, so it was getting ignored).

Can someone be so kind to either point me in the right direction or give me an example of the VirtualHost lines and the Host lines I need in Apache and Tomcat.

BTW, I am using the auto feature of Apache to create my jk file if that is any help.

I really appreciate any help on this, I need to get this up and running so I can learn as much on JSP as I can in the next week. Big project.
Bill Leighton

Joined: Oct 12, 2004
Posts: 3
If it helps, here are my current host information from httpd.conf and server.xml and what was created in the auto mod_jk file.



Bill Leighton

Joined: Oct 12, 2004
Posts: 3
Ok, think I got it. For anyone who is interested, the Auto file was overwriting the Virtual Host in the httpd.conf file and that Auto file was missing some of the needed directives. So, I edited the Auto file and it started working. Of course anytime I restart Tomcat I am going to get the error again, so I will have to edit it each time, but I will figure that part out later. Just glad I got it working.
I agree. Here's the link:
subject: Virtual Hosts with Tomcat/Apache
Similar Threads
How does Mod_JK connector work?
Apache HTTPD2.2 Virtual Host proxying calls to local Tomcat 6 for JSPs
JVM Configuration for Hosting Company
tomcat as a virtual host
How to setup Tomcat to run as user and daemon in Lunix/Redhat ?