webserver proxy

DevilWAHDevilWAH Posts: 2,997Member ■■■■■■■■□□
Hi,

Cheers for all the help in the past just one more question.

supose I only have one external IP address, but two internal web servers.

Is it possible to split virtual hosts in apache across the two physical servers?

In effect the first server would be acting as a proxy for the second server, so both could use the same external ip address on port 80.

Any ideas?

Aaron
  • If you can't explain it simply, you don't understand it well enough. Albert Einstein
  • An arrow can only be shot by pulling it backward. So when life is dragging you back with difficulties. It means that its going to launch you into something great. So just focus and keep aiming.

Comments

  • NightShade03NightShade03 Posts: 1,383Member ■■■■■■■□□□
    DevilWAH wrote: »
    Is it possible to split virtual hosts in apache across the two physical servers?

    Sort of...

    There are many different ways to do this:

    1) You can use the first server as a proxy and feed traffic to the second server which will contain both virtual hosts. I would do this only if you NEED a proxy.

    2) Forget the proxy, setup both servers with apache and virtual hosts and a heartbeat program so that they are load balancing. You can then use your DNS server and a single IP address. If the first or second server dies the other server is always available giving your redundancy.

    I think that #2 is the best setup for you (not too hard either). Let me know if this is what you were looking for.
  • demonfurbiedemonfurbie Posts: 1,819Member
    setup the router with QoS engine setup both servers with the same apache server but store the website on a nas so all updates made to the page are pulled from the same data set
    wgu undergrad: done ... woot!!
    WGU MS IT Management: done ... double woot :cheers:
  • DevilWAHDevilWAH Posts: 2,997Member ■■■■■■■■□□
    I not sure i explained my self well.

    lets say I have one web-server with two virtual hosts

    www.websiteA.com and www.websiteB.com. Both these are served by the public ip address 82.94.85.26, traffic comming to port 80 of this address is NAT translated to 172.16.3.25

    Easy enough. but what about if i move www.websiteB.com to a separate physical server with the internal IP address 172.16.3.30?

    external uses must still use 82.94.85.26 to reach the server and must both come in via port 80. So how do I split the traffic up, DNS load balancing wont work. it needs a method that looks at the incoming header request and splits that data between ther servers based on that.
    • If you can't explain it simply, you don't understand it well enough. Albert Einstein
    • An arrow can only be shot by pulling it backward. So when life is dragging you back with difficulties. It means that its going to launch you into something great. So just focus and keep aiming.
  • NightShade03NightShade03 Posts: 1,383Member ■■■■■■■□□□
    I mis-understood what you were looking for. I'm pretty sure you could accomplish what you are looking for with just Apache alone. You will need to setup the config file to use the mod_proxy module. Here is the ref page:

    mod_proxy - Apache HTTP Server

    Specifically you want to use the ProxyPass directive which will allow you to pass the request from the server to another server. I haven't done the setup you are asking for before but I can't image that it is that hard.

    Just curious...but why host SiteA on one server and SiteB on another?
  • DevilWAHDevilWAH Posts: 2,997Member ■■■■■■■■□□
    I mis-understood what you were looking for. I'm pretty sure you could accomplish what you are looking for with just Apache alone. You will need to setup the config file to use the mod_proxy module. Here is the ref page:

    mod_proxy - Apache HTTP Server

    Specifically you want to use the ProxyPass directive which will allow you to pass the request from the server to another server. I haven't done the setup you are asking for before but I can't image that it is that hard.

    Just curious...but why host SiteA on one server and SiteB on another?


    Honestly, when I got in to LINUX I was so new to it that I set up a web server on a desktop distribution of Linux. I now have 3 sites hosted on that one server/desktop and I want to migrate them across. Also the admin of one of the websites wants a test server set up as well.

    My idea is to move each site across in turn, and to help in doing this would be to keep the DNS/NAT/IP static for external users. Set up the new server and once I have the first site up and running, forward from the old to the new. Once I have done all 3 then I can point the NAT to the new servers IP and decommission the old server. So this is a kind of stop gap measure.

    And as I said one person wants a test set up (and these are always useful) so I might well forward the traffic to the test server using the same method. This would keep the use of IP address down to a minimum. I do have a few more but they are tied up and not really something I want to mess around with.

    Cheers for that though that seems to be just the ticket :)
    • If you can't explain it simply, you don't understand it well enough. Albert Einstein
    • An arrow can only be shot by pulling it backward. So when life is dragging you back with difficulties. It means that its going to launch you into something great. So just focus and keep aiming.
  • DevilWAHDevilWAH Posts: 2,997Member ■■■■■■■■□□
    how cool looks like you can put this inside the virtual host mappings :)
    <VirtualHost *:80>
        ServerAdmin [email protected]
        ServerName <my domain>.com
        ServerAlias www.<my domain>.com
        ProxyPass / http://localhost:8080/<web-app context root>/
        ProxyPassReverse / http://localhost:8080/<web-app context root>/
        ErrorLog logs/<my domain>.com-error_log
        CustomLog logs/<my domain>.com-access_log combined
    </VirtualHost>
    

    Because I might have a few web-servers/sites soon, I might even design a solution with one server that is purely a web proxy for multiply back end sites.
    • If you can't explain it simply, you don't understand it well enough. Albert Einstein
    • An arrow can only be shot by pulling it backward. So when life is dragging you back with difficulties. It means that its going to launch you into something great. So just focus and keep aiming.
  • NightShade03NightShade03 Posts: 1,383Member ■■■■■■■□□□
    Yeah we use ProxyPass extensively for multiple white labels @ work.

    Just remember that @ some point you should load balance across multiple proxies, because if you lose the head (your sole proxy) its bad news for the back end sites icon_wink.gif

    Glad it worked out for you though.
  • Forsaken_GAForsaken_GA Posts: 4,024Member
    DevilWAH wrote: »

    Because I might have a few web-servers/sites soon, I might even design a solution with one server that is purely a web proxy for multiply back end sites.

    Make sure you build some redundancy into this if so, single points of failure are bad.

    Edit: damnit, shoulda refreshed before responding hehe
  • NightShade03NightShade03 Posts: 1,383Member ■■■■■■■□□□
  • DevilWAHDevilWAH Posts: 2,997Member ■■■■■■■■□□
    Make sure you build some redundancy into this if so, single points of failure are bad.

    Man you talking to the redundancy king here ;)

    I have actually found that while redundancy is good for times a fail, it actually pays of just as much when you want to work on systems.

    In most companies, the largest cause of downtime is not the unplanned stuff, but the Planned downtime.

    My finally plan as this network grows is to have multiply load balanced back-end SQL servers, supporting multiply load balanced web servers, that in turn are supported by a redundant network.

    However as I only have 3 physical boxes on the network currently the level of redundancy is limited :). And currently not really necessary with the type of service and workload it needs to support.

    Again cheers for all the help, love this forum :)

    Devil
    • If you can't explain it simply, you don't understand it well enough. Albert Einstein
    • An arrow can only be shot by pulling it backward. So when life is dragging you back with difficulties. It means that its going to launch you into something great. So just focus and keep aiming.
  • NightShade03NightShade03 Posts: 1,383Member ■■■■■■■□□□
Sign In or Register to comment.