http forwarding to another internal IP

Discussion in 'Server Operation' started by ferra, Jul 13, 2010.

  1. ferra

    ferra New Member

    I have server1 and server2. Server1 is conneted to internet with dns server and apache, serving 3 domains,, and Ip address of server1 is
    server2 is an internal server running apache with 3 domains,, and Ip address of server2 is
    I want to have access of from internet, so have to configure the dns of on server1 and make apache redirect it to server2.
    The apache configuration for on server1 is:
    ProxyRequests off
    Proxyass /
    proxyPassReverse /

    When I access, server1 ir redirecting the ip address to server2, not the name server, so it gets the first domain in
    A solution for that is to give a second ip address for the nic on server2, and configure on that ip address, for example, and
    on server1
    ProxyRequests off
    Proxyass /
    proxyPassReverse /

    This way it works. is there another way to configure it?

  2. geek876

    geek876 New Member

    I think you are mixing name based virtual hosting with ip based virtual hosting. Try the below steps

    (1) Put DNS entry so ->
    (2) So,, and now point to .100 (server1) and the rest & point to .101 (server2).
    (3) Create a new DNS entry ex: point to .101 (server2). This will be substitute for
    (4) Create virtual hosts, , and on server1 as below

    Put below two lines somewhere under server1's apache main httpd.conf file and create a directory /etc/httpd/conf.d/virtual-hosts/ to hold virtual host config files.
    NameVirtualHost *:80
    Include /etc/httpd/conf.d/virtual-hosts/*.conf

    (5) For each domain on server1, create virtual host config file under /etc/httpd/conf.d/virtual-hosts/abc.conf

    <VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /<document root for abc>

    <other required options goes here>

    Create /etc/httpd/conf.d/virtual-hosts/def.conf,ghi.conf and xyz.conf as above. However for xyz.conf add below lines to facilitate proxy

    ProxyPass /
    ProxyPassReverse /

    (6) Create appropriate virtual hosts (, & as above points (4) & (5) on server2.

    PS: I am assuming you don't want https as apache only supports 1 virtual host with named based virtual hosting.

    Hope this helps.
  3. ferra

    ferra New Member

    Thanks for your replay.
    Don't forget, in server1 I have all the domains on the Internet, so the DNS entries for these domains all points to (a public address example).
    So,,, and on server1 points to the public address, how can i configure another entry on the DNS of server1 telling DNS to points to server2 (
    Can I have 2 DNS entries on server1 saying for to pints to and another one pointing to
  4. geek876

    geek876 New Member

    You do you want XYZ point to server2 too? Do you also want XYZ to be accessed (may be internally) directly from Server2 whereas access via Server1 is only for External Internet connections?
    You could
    (1) Have your internal DNS only pointing to server2 for whereas external dns points to server1 for, or
    (2) Just access as internally.
  5. ferra

    ferra New Member

    thanks a lot.
    Ok, I understund now your point.

Share This Page