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 production site, running off 10 servers. I've been given another virtual server on the same network as these 10 servers, to use for testing purposes. This server doesn't have it's own DNS entry. Therefore I need to do a redirect to the site hosted on this virtual server for a sub-domain of the site running on the 10 other servers.

So Basically I was wondering how I would configure a sub domain of my production server to point at the Virtual server for testing.

I'm guessing I need to modify my site file in

/etc/apache2/sites-available

and add another virtual host like the following and modify the redirect match:

<VirtualHost *>
        ServerName SUBDOMAIN.DOMAIN.com
        RedirectMatch 301 (.*) **IP ADDRESS**
        CustomLog /var/log/apache2/SUBDOMAIN.DOMAIN.com.access.log combined
</VirtualHost>

Do I set the redirect match to just the IP on the Virtual server, and then configure another site file in the sites-available directory, which will recption this redirect and point the browser towards the HTML root?

Thanks, I hope I made myself clear.

share|improve this question
    
Do you want simply to redirect to the test server or do you want the address to stay in the address bar? You could take a look at mod_proxy: httpd.apache.org/docs/2.2/mod/mod_proxy.html –  Frands Hansen Feb 17 '11 at 13:02
    
preferably to have the address stay in the address bar. basically have it act as a sub-domain, and when you go to that URL and visit pages it'll stay with the subdomain in the URl as one browses the site. Will have a look at that link. Thank you –  Mark Cameron Feb 17 '11 at 14:24
add comment

1 Answer 1

zeroFIG@ when you do a 301 redirection the address in the address bar will change. If you want to keep the address the same you can look at apache mod_proxy as pointed out by fbh@.

Secondly if its an internal server, with an internal IP your clients will get an error. i.e if example.com redirected to 192.168.1.100/index.html then I will get a error if I am access the site over the internet.

share|improve this answer
    
I see I see, so if there isn't a public IP for that virtual server, there is no way to access it from outside of the VLAN where the servers lie. If there is, I'd not want to do a 301, otherwise they would have the IP of the server in their address bar. SO what redirect code would I use? –  Mark Cameron Feb 17 '11 at 15:41
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.