Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 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!


share|improve this question
up vote 0 down vote accepted

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/
JkShmFile      /var/log/httpd/mod_jk.shm
JkLogFile      /var/log/httpd/mod_jk.log
JkLogLevel     error

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

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

share|improve this answer
Hi, I will give it a try. Sounds like exactly what I need! Thanks! – Konrad Jul 12 '10 at 6:57

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.