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 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: 121.55.44.101 (10.0.0.1 internal)
  • Web server IP: (internal 10.0.0.80)
  • New server IP: (internal 10.0.0.75)

Example Domains

  • www.baskets.com.au (points to DNS server and forwarded to web server)
  • www.rollerblade.net (points to DNS server and forwarded to web server)
  • www.bananas.com.au (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
1  
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 121.55.44.101:81 which i have port forwarded in ufw to 10.0.0.75:80 this works but is very messy. I would like to be able to redirect www.bananas.com.au 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
add comment

migrated from superuser.com Sep 15 '11 at 20:33

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

1 Answer

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