Solved

Setup virtual host to look at different computer

Posted on 2006-06-20
18
324 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
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
 
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
In this article we will learn how to backup a VMware farm using Nakivo Backup & Replication. In this tutorial we will install the software on a Windows 2012 R2 Server.
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

770 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