Find the answer to your Linux question:
Results 1 to 5 of 5
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Apache - 2 servers 1 ip

    I have a few things I am wanting to learn/do.

    1st is I have www site net and I have just built a moodle server that I want to run as well. Because of the way it does it's addressing, it needs to be know to the world.

    I can get to it internally because I have an internal DNS server pointing to it.

    I have one DMZ based DNS server and it appears I need to have 2 servers if I want things to work right such as www site edu to work since the .edu people require 2 named ( ie ns1 and ns2 ) name servers to point to to set it up.

    I'd like to know how to do both ways if anyone has the knowledge and time:

    I see I can do a - Using Virtual_host and mod_proxy together from VirtualHost Examples - Apache HTTP Server
    allowing my www machine to point to my moodle machine.

    But I get a little lost on what to do especially around the securing it part.

    would it be transparent? That is if I go to www mysite net, I would go to my main server and I go to moodle site net the main server will just transfer you to it and it would be just as if it was the main server?

    would anyone be willing to help me get through this?

    Thanks for any help.


  2. #2


    OK, first of all, let me make sure I understand what you are saying.

    You have two separate machines each hosting a web site behind a firewall of some sort. You only have 1 external IP address.

    You have a few options here.

    Option 1: Just run both sites on one server and use name based virtual hosting. This might not be an option if you need to keep them on separate machines.

    Option 2: Just run the moodle server on a different port. You could then forward port 80 to your existing web server and another port to your moodle server. You could then simply use a redirect so that the folks using your moodle server would not have to know about the port.

    Option 3: Do just what you suggest below. Use mod_proxy and virtual domains. Here is how you would do it.

    First, you need this line to be in your apache config file of the main server before the the virtualhost config below.

    NameVirtualHost *

    This tells the apache server to look for virtual hosts on any ip and any port.

    Next you need something like this.

    <VirtualHost *:*>
    ProxyPreserveHost On
    ProxyPass /
    ProxyPassReverse /

    Replace with internal IP address of the server running moogle.
    Replace with the name you are using for moodle.

    This tells apache that whenever comes in using the URL proxy the traffic and send the request to the moodle server.

    It would be totally transparent to the outside world. There should not be any significant security concerns here as long as both sites are setup securely themselves and apache is not listening on standard ports.

    NOTE: If you have 2 external IP addresses you could just forward one address to one server and the other to the other.

  3. #3
    You nailed it right on.

    I have 2 servers, Moodle claims to need to be on it's own for usage load. It also wants it's internal address for going back to 'home' for instance to use the root ip line from the config file. If ir it static, internal will work fine but external will not, maybe not at all. It wants something like
    HTML Code:
    so internally or externally it will get the right ip.

    I do presently have 4 ips. This may change where I will have 1. To be prepared and to just simply know how to, I wanted to be able to redirect to that box on one ip.

    It will help me also when I am able to set up my own DNS server either on campus or off so I can make more of the changes and set-ups myself too.

    Thank you very much for the help. If there is any other pitfalls you see I may hit, love to know about them.



  4. $spacer_open
  5. #4
    The only other thing I can think of is that you will also need to add a virtual host record for your original site.

    So putting it all together it will look roughly like this.

    NameVirtualHost *

    <VirtualHost *>
    ProxyPreserveHost On
    ProxyPass /
    ProxyPassReverse /

    <VirtualHost *>
    All the original directives

    The ServerName directive is import since it is how name based virtual hosts work.

    Name based virtual hosts cannot be used with ssl.

  6. #5
    Thank you very much!

    Gonna dig into it to see if I can get it going!



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts