Solved

Setup virtual host to look at different computer

Posted on 2006-06-20
18
322 Views
Last Modified: 2013-11-15
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.
0
Comment
Question by:thaimin
  • 6
  • 6
  • 6
18 Comments
 
LVL 15

Assisted Solution

by:periwinkle
periwinkle earned 25 total points
ID: 16954280
I believe that you need to look into mod_proxy - see:

http://httpd.apache.org/docs/2.2/mod/mod_proxy.html
0
 
LVL 1

Author Comment

by:thaimin
ID: 16957016
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
 
LVL 15

Expert Comment

by:periwinkle
ID: 16959289
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
 
LVL 6

Accepted Solution

by:
philjones85 earned 225 total points
ID: 16959794
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
 
LVL 15

Expert Comment

by:periwinkle
ID: 16960157
Thanks, Phil - Glad someone was there to step in with experience!
0
 
LVL 6

Expert Comment

by:philjones85
ID: 16960220
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
 
LVL 1

Author Comment

by:thaimin
ID: 16965334
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
 
LVL 6

Expert Comment

by:philjones85
ID: 16965449
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
 
LVL 1

Author Comment

by:thaimin
ID: 16965526
well, thanks anyways. i didnt really need that part necessarily. thanks for all of the other help.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 15

Expert Comment

by:periwinkle
ID: 16968348
I'm glad that things are progressing for you - thanks for the kind assist - Phil really did most of the work!
0
 
LVL 6

Expert Comment

by:philjones85
ID: 16968368
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
 
LVL 15

Expert Comment

by:periwinkle
ID: 16968482
lol - true, true, it's not about the points, is it. ;)
0
 
LVL 1

Author Comment

by:thaimin
ID: 16970651
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
 
LVL 6

Expert Comment

by:philjones85
ID: 16971068
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
 
LVL 1

Author Comment

by:thaimin
ID: 16973020
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
 
LVL 6

Expert Comment

by:philjones85
ID: 16973041
lol, i was joking.
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 16973048
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
 
LVL 1

Author Comment

by:thaimin
ID: 16973332
oh, okay :-)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
This tutorial will walk an individual through the process of installing of Data Protection Manager on a server running Windows Server 2012 R2, including the prerequisites. Microsoft .Net 3.5 is required. To install this feature, go to Server Manager…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now