Setup virtual host to look at different computer

I might be going about this the wrong way, but....

Is there a way to setup a virtual host to grab documents from another web server?

So, I have the address popcorn.hopto.org, and when that address is given, then apache should get the documents at 192.168.0.101, but I do not want a redirect (it is impossible since the other computer is only visible on the local network).

All other virtual hosts should look at the same (default) document folder though.
LVL 1
thaiminAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
philjones85Connect With a Mentor Commented:
actually, i just did this.

the external machine is setup with apache with the following virtual hosts

<VirtualHost *:80>
    ServerAdmin xxx@yyy.com
    DocumentRoot "/var/www/html"
    ServerName xxx.yyy.com
    ErrorLog logs/error_log
    CustomLog logs/access_log combined
</VirtualHost>

<VirtualHost *:80>
        ServerAdmin xxx@yyy.com
        ServerName aaa.yyy.com
        CustomLog logs/aaa.yyy.com-combined_log combined
        ProxyPreserveHost On
        ProxyPass / http://192.168.0.2:80/
</VirtualHost>

<VirtualHost *:80>
        ServerAdmin xxx@yyy.com
        ServerName bbb.yyy.com
        CustomLog logs/bbb.yyy.com-combined_log combined
        ProxyPreserveHost On
        ProxyPass / http://192.168.0.3:80/
</VirtualHost>

<VirtualHost *:80>
        ServerAdmin xxx@yyy.com
        ServerName ccc.yyy.com
        CustomLog logs/ccc.yyy.com-combined_log combined
        ProxyPreserveHost On
        ProxyPass / http://192.168.0.4:80/
</VirtualHost>


----------------------------------------

then setup the internal server(s) normally.  the ProxyPreserveHost On option will pass through the domain request so you can run Virtual Hosts on the internal servers as well.
0
 
periwinkleConnect With a Mentor Commented:
I believe that you need to look into mod_proxy - see:

http://httpd.apache.org/docs/2.2/mod/mod_proxy.html
0
 
thaiminAuthor Commented:
okay......so i kind of looked that over, can you give me any help on setting it up? I'm not very good with apache (I use an XAMPP distribution). I know about editing the HTTPD.conf file, i really dont know how, but I'm guessing all the directives they are talking about go in there.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
periwinkleCommented:
I'm sorry - I don't really have much experience with mod_proxy, but wanted to point you in the right direction... hopefully someone else will chime in!
0
 
periwinkleCommented:
Thanks, Phil - Glad someone was there to step in with experience!
0
 
philjones85Commented:
that's what we're here for, i figured that out with help from other on this site too,  let's just hope it helped and i didn't forget anything...
0
 
thaiminAuthor Commented:
Okay, it works very nicely, and even has taught me how to setup normal virutal hosts.

I have one more question. Is it possible to use the proxy to look at a directory of an internal serval? This what I tried:

#RPA (proxy)
<VirtualHost *:80>
    ServerAdmin xxx@yyy.com
    ServerName rpa.hopto.org
    CustomLog logs/rpa-combined_log combined
    ProxyPreserveHost On
    ProxyPass / http://192.168.0.100:80/rpa
</VirtualHost>

Basically, I want it when you go to http://rpa.hopto.org/ it to read from http://192.168.0.100:80/rpa. What ends up happening though is that it redirects the page to http://rpa.hopto.org/rpa/ and displays "The Object cannot be found"
0
 
philjones85Commented:
i don't think it possible because of the nature of what you're trying to do.  an http request comes in like
GET /somefile.html HTTP/1.1
Host: somehost.com

when your external server gets it, it passes it to 192.168.0.100.  the problem is, when the internal server gets it, it takes the HOST and the REQUEST and adds them together as "somehost.com/somefile.html"

the 192.168.0.100 isn't part of the http request, its just a location to pass the request onto.

that's my 2 cents anyway

0
 
thaiminAuthor Commented:
well, thanks anyways. i didnt really need that part necessarily. thanks for all of the other help.
0
 
periwinkleCommented:
I'm glad that things are progressing for you - thanks for the kind assist - Phil really did most of the work!
0
 
philjones85Commented:
its all good, i'd only be upset if it was the last day of the month and the points he gave you cost me my free membership :)

funny thing about us computer nerds, we actually enjoy helping others...
0
 
periwinkleCommented:
lol - true, true, it's not about the points, is it. ;)
0
 
thaiminAuthor Commented:
well, you did help. phil didnt tell me i had to include all the modules for the proxy pages, and the website you gave me, thats about the only thing i got out of it :-).
0
 
philjones85Commented:
yeah, i didn't know if i had remembered everything, i did it once about a month ago.  i looked back through my httpd.conf file and that was all that stuck out to me.  

but i would looked a little harder if i could have gotten a few more points, geez...
0
 
thaiminAuthor Commented:
well, actually, im basically out....thats why it was so little....usually i give 500, but giving that much in the past has taken its toll
0
 
philjones85Commented:
lol, i was joking.
0
 
periwinkleCommented:
thaimin - I think Phil was making a joke about my comments about "it's not about the points" - perhaps a smiley would have made it a little more apparent, but no negativity was meant :)
0
 
thaiminAuthor Commented:
oh, okay :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.