Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
    
typo alert: you have <VistualHost *:5678> with an s instead of an r. –  ramruma Mar 25 '12 at 7:05
add comment

1 Answer

You can use the apache server as a proxy, blindly forwarding the requests to the sites. To configure the apache server to act as a proxy, you need something like this in the config file:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

<Proxy *>
    Order deny,allow
    Allow from 127.0.0.1
</Proxy>

NameVirtualHost 0.0.0.0:80
<VirtualHost 0.0.0.0:80>
    ServerName sources.example.com

    ProxyPass        / http://localhost:5678/svn/
    ProxyPassReverse / http://localhost:5678/svn/
</VirtualHost>
share|improve this answer
add comment

Your Answer

 
discard

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.