cancel
Showing results for 
Search instead for 
Did you mean: 

Website redirection to other server on same network ?

picbits
Community Veteran
Posts: 3,428
Thanks: 22
Registered: ‎18-01-2013

Website redirection to other server on same network ?

To save me Googling this for ages ......
My website lands on a page on server running as a virtual machine. This handles email and web while another separate couple of virtual machines handle other tasks on my network.
Ideally I'd like to run separate servers for mail, web, forum, shop etc. This is easily done for the mail by redirecting ports 110 and 25 etc to my VM which is running the email server.
What I need is to filter the incoming traffic to the appropriate virtual machine i.e.
www.mydomain.com/shop -> 192.168.5.100
www.mydomain.com/forum -> 192.168.5.101
www.mydomain.com/private -> 192.168.5.102
etc etc.
Any easy way to do it ? I know I could use different ports i,e, www.mydomain.com:81 -> 192.168.5.100 as port mapping on the router but it would be neater for people to land on my home page then get redirected (seamlessly) to the appropriate server without even noticing there was a redirect going on.
Pointers ? Places to look ? Keywords to Google ? Examples ? All will help Cheesy
Ta
Dom
4 REPLIES 4
jelv
Community Veteran
Posts: 26,786
Thanks: 990
Fixes: 10
Registered: ‎10-04-2007

Re: Website redirection to other server on same network ?

Have you considered shop.mydomain.com, forum.mydomain.com, private.mydomain.com?
That would be a doddle with DNS entries - but you would need an IP block if the servers are on your LAN.
jelv (a.k.a Spoon Whittler)
   Why I have left Plusnet (warning: long post!)   
Broadband: Andrews & Arnold Home::1 (FTTC 80/20)
Line rental: Pulse 8 Home Line Rental (£14.40/month)
Mobile: iD mobile (£4/month)
picbits
Community Veteran
Posts: 3,428
Thanks: 22
Registered: ‎18-01-2013

Re: Website redirection to other server on same network ?

That is where the plan falls down - I have a single static IP.
My website traffic is minimal but specialist and I'd like to keep various people out of various areas which would be easier to do with multiple VMs running dedicated sites.
I had/have huge problems with Chinese and Russian hackers so by segmenting everything makes it slightly easier to manage.
I'm looking at the mod_rewrite directives in Apache at the moment - before I embark on this I just wanted some input from members with a bit more web knowledge than me Smiley
*Edit - stumbled upon proxypass which could well do the job. Will have to experiment tomorrow !
zubel
Community Veteran
Posts: 3,789
Thanks: 1
Registered: ‎08-06-2007

Re: Website redirection to other server on same network ?

Use nginx and the Reverse Proxy function.
You can do something similar to:
location /shop {
    proxy_pass http://192.168.5.100/;
    proxy_redirect off;
    proxy_buffering off;
    proxy_set_header        Host            $host;
    proxy_set_header        X-Real-IP      $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /forum {
    proxy_pass http://192.168.5.101/;
    proxy_redirect off;
    proxy_buffering off;
    proxy_set_header        Host            $host;
    proxy_set_header        X-Real-IP      $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
}
http://wiki.nginx.org/HttpProxyModule
Cheers
B.
picbits
Community Veteran
Posts: 3,428
Thanks: 22
Registered: ‎18-01-2013

Re: Website redirection to other server on same network ?

Thanks Barry - I just found proxypass on my journeys (I run Apache by the way).
I was just editing my post as you posted Smiley
Will give it a play tomorrow.
Dom