HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=27)
-   -   Sub-domain redirect to Virtual machine (http://www.howtoforge.com/forums/showthread.php?t=54604)

sjswarts 22nd October 2011 12:16

Sub-domain redirect to Virtual machine
 
Hi guys, (IP addresses aren't real)

I HAVE purchased the ISPConfig Manual already - still can't figure it out
What I need to do is this:

I have a Debian Server running ISPConfig 3 which works fine with my websites so far. What I want to do is host a sub domain on a virtual machine.

Currently my setup is
ISPConfig 3 server : 192.168.1.1/24 server1.example.com
Virtual Machine: 192.168.1.8/24 server2.example.com

If i put the ip address into the url with 192.168.1.8/test it shows the website i want, but if i put in www.example.com/test it comes back with a error.

I have added a sub-domain in ISPConfig
Host: server2
Domain: example.com
Redirect: R,L
Redirect path: http://server2.example.com/test/

I have a CNAME entry as
server2 192.168.1.8

What am I missing??? This has me stumped... Thanks in advance

falko 23rd October 2011 18:50

Quote:

Originally Posted by sjswarts (Post 265740)
I have added a sub-domain in ISPConfig
Host: server2
Domain: example.com
Redirect: R,L
Redirect path: http://<font color="Red">server2</fo...mple.com/test/

You want to redirect the subdomain server2.example.com to server2.example.com? I think you have a loop there...

sjswarts 23rd October 2011 19:35

Quote:

Originally Posted by falko (Post 265767)
You want to redirect the subdomain server2.example.com to server2.example.com? I think you have a loop there...

That could be ... what I need to know is how to achieve my goal.

I have www.example.com going to my normal website on server1.example.com which has for its IP 192.168.1.1/24 - this is working already.

Now I also want when people access a link or directly enter into the URL www.example.com/example that it redirects to my second server which has a hostname server2.example.com ip 192.168.1.8/24 and is also running apache

I am wondering how do I do this in ISPConfig 3 or is there a better way to achieve the same goal?

Thanks for your response

Steve

falko 24th October 2011 10:36

Go to the Redirect tab of your website in ISPConfig and configure your redirect there.

sjswarts 24th October 2011 11:04

That would work if I had the server else where but I don't.

They are physically at the same address on the same internet connection coming from the same ADSL router - obviously I can't forward port 80 to both only one

This is the connection:

ADSL Router (1) ==port forward 80==> Debian Server1 hosts www.example.com

ADSL Router (1) ==NO PORT FORWARD===> Debian Server2 hosts www.example.com/example

Server1 192.168.1.1/24
Server2 192.168.1.8/24

How do I get Server1 to redirect a URL request asking for www.example.com/example to server2 on the same network?

Thanks steve

till 24th October 2011 11:24

You can do this e.g. by configuring a reverse proxy with apache mod_proxy.

sjswarts 24th October 2011 11:29

Thats what I have found out so far from google but I'm wondering how I can do that with ISPConfig installed... Where do i put it and what do I put in...

If you could please direct me to a good site that would be fantastic

Cheers,
Steve

till 24th October 2011 11:49

I dont have a link to a site at hand. But in general, it should be enough to add the directives for the reverse proxy in the apache directives field of the website in ispconfig.

Before you do that, make sure that the apache reverse proxy modules are installed and loaded on your server.

sjswarts 24th October 2011 13:27

Ok Till thank you for your comment seems like i'm in the right direction...

this is a extract from my vhost file on the website that I want to run apache reverse proxy...
================================================== ====
ProxyRequests Off
ProxyPreserveHost On

<Proxy 192.168.1.1:80>
Order deny,allow
Allow from all
</Proxy>

ProxyPass /example http://server2.example.com/
ProxyPassReverse /example http://server2.example.com/
================================================== ====
i have also added a CNAME in dns:

server2.example.com.
192.168.1.8

It comes up with a error not found which is different than before so I am on the right track "hope"

What am I doing wrong?

Thanks
steve

till 24th October 2011 13:31

The question is if there is a problem with the proxy or the target page. Lets first test the target page:

Do you get the correct page when you open the URL http://server2.example.com/ inside your local network in a browser?


All times are GMT +2. The time now is 07:19.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.