Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Virtual Hosts with Tomcat/Apache

 
Bill Leighton
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 testjsp.mydomain.com, 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
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

httpd.conf...


server.xml....


mod_jk....
 
Bill Leighton
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic