0

I have question. Let's assume that I have API which allows me to add dynamically add DNS records. Now, I would like to run simple application on Tomcat and put Apache in front of it, so that any domain added to DNS pointing on this Apache would be served by application running. I read a bit about Dynamically Configured Mass Virtual Hosting on http://httpd.apache.org/docs/2.0/vhosts/mass.html but this seams would work when domains would point to some directory, when usually I was using mod_jk to use Apache and Tomcat together. So my other finding was mod_proxy but how to tell apache simply to serve any domain on web app?

Please forgive me if I am asking about something obvious for administration gurus, but I do not have to much experience with this subject.

Thanks in advance!

Konrad

Konrad Pawlus
  • 133
  • 1
  • 1
  • 7

2 Answers2

0

I have no experience with tomcat, but using apache hooks you can build a module that intercepts the request processing phase, and do a redirect depending on the "hostname" attribute. Hope it helps.

huguei
  • 31
  • 2
0

If I understand you correctly, it's simple - the first virtual host listed in the Apache config traps any unknown domain name by the server. So all you need to do is enable name-based virtual hosts and define only one default vhost that jkmounts your Tomcat webapp. I prefer using mod_jk for Apache <=> Tomcat.

NameVirtualHost *:80

LoadModule jk_module /usr/local/lib/mod_jk.so
JkShmFile      /var/log/httpd/mod_jk.shm
JkLogFile      /var/log/httpd/mod_jk.log
JkLogLevel     error

<VirtualHost *:80>
 ...other options ...
 JkMount /* ajp13
</VirtualHost>

That's the basic setup, see here for more.