Running two webservers on same network

Discussion in 'Server Operation' started by atjensen11, Feb 23, 2009.

  1. atjensen11

    atjensen11 New Member


    Some time ago, I built a Linux server using one of the excellent How-To articles here on the site. The server currently handles email, web, ftp, and DNS traffic.

    I am getting close to bringing a new machine online to replace the existing machine.

    In order to slowly migrate services over to the new machine, I was curious if it is possible to run two web servers on the same network. I know it is quite possible to configure them to run on different ports and then forward ports on the gateway router appropriately. This is not the desired functionality I want. Rather, I want the services to run on the default port (i.e. 80).

    Research online has led me to believe it is possible by configuring a reverse proxy. I have seen many examples of High Availability clusters that operate in a similar but different fashion. The examples I have found all appear to deal with one domain where some URL's are sent to a server for the sales department and others are sent to a marketing server.

    I have not yet found documentation or examples on how to have a proxy server effectively pass traffic to a backend server based on unique domains.

    Any input would be appreciated.
  2. falko

    falko Super Moderator ISPConfig Developer

  3. stefanos

    stefanos Member


    Apologies for bringing this post back to life. I came across the same issue in a different form.

    I am running A perfect server Debian Lenny, and I have also installed VMware. I need VMware as a backup solution for another server.

    It struck me that how would it be possible to run 2 web servers both on port 80.

    Falko pointed me in the direction of mod_proxy. I think I found a solution here:

    Only problem now for me would be integrating this within ispconfig 3

    I hope this helps.
  4. reason8

    reason8 Member

    How do any of those three options work to allow a second webserver running ISPConfig 3 to run on port 80 along with a primary ISPConfig webserver?

    Must all 3 options be implemented or would any one of them work?
  5. stefanos

    stefanos Member

    Hi reason8,

    The way I understand it works is if you have a front end webserver that accepts all HTTP requests and then forwards it on as per your hosts file (or your internal DNS server).

    My VirtualHost config looks like this:
    <VirtualHost *:80>

    ProxyRequests Off

    <Proxy *>
    Order deny,allow
    Allow from all

    ProxyPass /
    ProxyPassReverse /

    I have put the domains in the hosts file with the server ip as follows.


    You need to do it this way as the servers ( & need the host address to be passed in the GET request.

    Personaly I run ISPconfig on a different port number but I have 4 vmware servers working (3 X Debian Lenny, 1 X Ubuntu), 1 is the front end Rev Proxy server that has a FIREWALL installed etc...

    I think I did it with :
    and with referance:

    Kind regards
  6. reason8

    reason8 Member


    Thanks for your response to this message. I really appreciate it.

    I am running ISPConfig 3 on OpenSuse 11.1
    The problem that I had with the document for the apache reverse proxy is that on several parts of the process, some of the files were different for SuSe and when I did resolve these problems, the code inside of the files were not the same as the how to document. Such as the file:

    $go_info["server"]["server_url"] = 'http://'.$_SERVER['HTTP_HOST'];
    } else {
    $go_info["server"]["server_url"] = "";

    The above was no where to be found in my (which was located in two different directories).

    Also, for your /etc/hosts config, what do you put for X.X.X.11 when that server has multiple websites (called virtual hosts?) located on it? My main webserver is hosting a few different websites so what would I put in this file for the primary server? Could I simply put "localhost" or should I put the name of the server itself?

    Do you have any experience with OpenSuSe?

    Thanks again!



    I implemented your example and when it runs the configuration file from the /etc/apache2/vhosts.d/example.conf file, I get an error of :
    Syntax error on line 5 of /etc/apache2/vhosts.d/example.conf:
    Invalid command 'ProxyRequests', perhaps misspelled or defined by a module not included in the server configuration.

    I have researched correcting this problem by making sure apache2-mod_proxy_html is installed (it is).
    I tried using the LoadModule directive in httpd.conf but I get an error that it can not find the file in /srv/www
    The file is in fact located in these two directories:


    So I am at a stand still. :(

    Is anyone else having (or had) this problem with this ProxyRequests error?
    Any help would be appreciated.


    I resolved the proxyreverse off error. I needed to install mod_proxy and not apache2_mod_proxy. This seems to have resolved the issue other than needing to change a shared objects link in the mod_proxy_html.conf file.

    Not the problem I am having (which I was having before) is that there are no lines in:

    which are look like the following:
    $go_info["server"]["server_url"] = 'http://'.$_SERVER['HTTP_HOST'];
    } else {
    $go_info["server"]["server_url"] = "";

    as per the documentation on

    Am I looking at the wrong file? I am on a OpenSuse server versus a debian but I would assume that the file would be the same on all distros. Am I incorrect in my assumption?
    Last edited: Oct 10, 2009
  7. stefanos

    stefanos Member


    Sorry I cannot help with the However I think that there is an option when you install as to what port to run on. As I said I left mine on port 81 (but this should not be a problem if the RevProxy is working as you can RevProxy for IspConfig to port 81 on your internal server. So I would leave this alone and do it via the RevProxy.

    ProxyPass /
    ProxyPassReverse /

    As for the /etc/hosts this is the anoying part every time you add a new site in ISPConfig you need to conf the RevProxy server to point to the new host.

    i.e. add in the /etc/hosts the line to the server
    eg: auth

    you also need to create the new vhosts file (/etc/apache2/sites-available) and run:
    a2ensite server3.vhost

    And don't forget you will need to restart Apache!!
  8. reason8

    reason8 Member

    Ok. I think I got it up and running. I didnt run a2ensite though. I dont know if this matters or not but it seems like the forwarding is working (even for the ports). My question is, do you need to have vhost (server.conf) files on BOTH servers or just the primary? Currently I have them on both but I am unsure if this is necessary.

  9. stefanos

    stefanos Member

    Hi Reason8,

    That is good news if it's working.

    What I did was point port 80 from my ADSL router to one of my internal webservers and made sure that it was working as it was ment to. If you are vhosts on your internal server make sure it works.

    I then built the my front end RevProxy server as per above and changed my ADSL router to point to the new front end Revproxy server.

    So in short, make sure your back end servers works as normal as if each is was itself a front end server then do not touch them. Then configure the RevProxy server to forward requests to your internal server. You should end up with your normal webserver conf files on your internal servers and the

    conf's on your front end server and that is it.

    If it helps this is my conf file of one of my internal servers:

    And ofcourse the hosts file:
    hope it helps
  10. reason8

    reason8 Member


    Some how I broke the rev proxy (had 2 putty windows opened and removed mod_proxy from the front end and now apache will not reload).

    What do you have for your httpd.conf file for LoadModules and your mod_proxy_html.conf file?

    Did you install apache2_mod_proxy (RPM or source) or just mod_proxy? Or did you install either of them?

    Also, what is server3.vhost you were referring to? And to be clear, you have a configuration file on the second (internal server) as well? Where does this file go? What is the naming convention for it? Why do you have it pointing to server1 directory (on your local machine). Isnt server 1 on the front end proxy?

    This is driving me nuts. I think I have a few more grey hairs :p

  11. reason8

    reason8 Member

    This I dont understand. My new website (host?) will be on the second machine. But I create it in server1's control panel? Why do I need to create a new vhost file? Doesnt ISPConfig do this when you create a new site in sites-available? I am totally confused by this process.

    Also, a2ensite is not a command on my OpenSuse box. What does this program do?

    By the way, ISPCOnfig does not install on port 81. It installes the control panel on port 8080 by default but all websites are on port 80. Where did 81 come from?
  12. reason8

    reason8 Member

    So this configuration file goes on server 1 (the primary webserver aka per your documentation) and is saved in /apache2/ as foo.conf (correct)?
  13. reason8

    reason8 Member

    So where do these conf files go on the front end and the back end servers? I think I am getting confused. There are the conf files in the /apache2/vhost.d directory, vhost files in the /sites-available/ directory with symlinks to /sites-enabled. What goes where?

    Where does the rev proxy conf file go?

Share This Page