How to configure Apache and Tomcat with vhosts?

Posted by Umar Farooq Khawaja on Server Fault See other posts from Server Fault or by Umar Farooq Khawaja
Published on 2010-04-30T16:36:52Z Indexed on 2010/04/30 16:48 UTC
Read the original article Hit count: 621

I have a server with a static, public IP address. I also have a registered domain name.

For the sake of illustration, let's suppose they are

  • IP Address: 12.34.56.78
  • Domain Name: example.com

I have a single machine on which I am running the following:

  1. A website (over IIS7) available locally at localhost:80
  2. A JetBrains TeamCity instance (over Tomcat) available locally at localhost:1234
  3. A VisualSVN Server instance (over Apache) available locally at localhost:5678/svn

I have set up an A record for example.com and the following CNAME records:

  • www.example.com
  • builds.example.com
  • sources.example.com

I would like to configure Tomcat and Apache such that:

  • if I point my browser at builds.example.com, I end up at the JetBrains TeamCity instance and,
  • if I point my browser at sources.example.com, I end up at the VisualSVN Server instance.

I thought I could configure the Apache to vhost example.com:5678/svn to point to sources.example.com and added the following lines to the Apache httpd.conf file

Listen 5678

NameVirtualHost *:5678

<VistualHost *:5678>
  ServerName sources.example.com
  DocumentRoot /svn
</virtualHost>

That broke the VisualSVN instance, so I had to revert that to

Listen 5678

Help!

© Server Fault or respective owner

Related posts about subdomain

Related posts about apache