Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 a DNS server setup with Bind9 and ufw as the firewall. ufw forwards all web traffic to our web server however I would like to redirect one domain to a different server.

Example Servers

  • DNS server IP: ( internal)
  • Web server IP: (internal
  • New server IP: (internal

Example Domains

  • (points to DNS server and forwarded to web server)
  • (points to DNS server and forwarded to web server)
  • (points to DNS server but would like it to redirect to the New server)

How do I go about doing this?

I have been messing around with Bind9, ufw, host files, apache redirects and can not get it working. Any help would be greatly appreciated.

share|improve this question

migrated from Sep 15 '11 at 20:33

This question came from our site for computer enthusiasts and power users.

You'll want to use HTTP redirects. What config have you tried in Apache? – Shane Madden Sep 15 '11 at 21:07
Is it possible to get another IP address outside on the DNS Server? Without that you will not be able to use port 80. HTTP vhosts use a header in the HTTP request, and you will not be able to intercept it with bind or UFW. IF you can bind a secondary public IP address to the DNS server outside, then you can NAT that over to the new internal. If you cannot do that, and you don't mind using the existing web server, you can use Apache like a proxy to proxy the requests on that vhost over to the new server. – Doon Sep 15 '11 at 21:18
@Shane Madden in apache I have set it up as a normal site and that has a php 301 redirect to the which i have port forwarded in ufw to this works but is very messy. I would like to be able to redirect on the DNS server before it is send to the Web Server due to the port forward. Is there a way to redirect this before ufw touches it so to speak? – Craig Sep 16 '11 at 0:15
@Doon what is required to setup the proxy to proxy with Apache? – Craig Sep 16 '11 at 0:17
DNS doesn't speak HTTP, and cannot redirect an HTTP request. After re-reading your question, it looks like you're keeping one public IP and wanting to host sites from two different servers? If this is the case, you'll want to look into setting up your Apache as a reverse proxy as @Doon mentioned. Review reverse-proxy for some example configurations. – Shane Madden Sep 16 '11 at 0:42
up vote 1 down vote accepted

As mentioned in the comments, without another IP address you can't do this at the DNS/router/firewall level.

You can do this at the http server level. You set this up using a reverse proxy. To do this using Apache you use mod_proxy.

share|improve this answer
Thanks all, that has worked exactly the way I wanted. – Craig Sep 16 '11 at 4:54

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.