Multiple Webserver, one public IP



  • I have PFsense as my firewall/router. The problem is I want to host two webserver using 1 public IP

    on PFsense NAT I use different ports. One  is 80(1st webserver)  the other one is 8081(2nd webserver).

    Within our LAN it works but when accessing it outside it fails.

    Is theres something that I must do besides configuring the NAT?

    Thanx


  • LAYER 8 Global Moderator

    you have to access it via port on your url from outside

    http://something.publicdomain.tld

    would access default port 80 and and your forward of port 80 to 1st webserver

    if you forwarded 8081 to 2nd server, then you would access via

    http://something.publicdomain.tld:8081

    if you want to access via some different name, then you would have to use a reverse proxy on pfsense to know that

    name.publicdomain.tld goes to webserver 1, and other.publicdomain.tld goes to webserver 2.  If using a reverse proxy then both servers could be on port 80.  And would not be needed in the url

    If not using a proxy then the only way to access different webservers behind your nat is to use different ports like what your doing.  but you have to spell out that other port in the url used to access it.



  • You could use Apache's virtual server parms so you can keep using port 80 across multiple websites on a single IP.
    http://httpd.apache.org/docs/2.2/vhosts/examples.html


  • LAYER 8 Global Moderator

    ^ yup that would be only 1 webserver though behind pfsense.

    Nothing running on the webserver would allow for pfsense to send it to different webserver, that has to be done with reverse proxy on pfsense.



  • Reverse Proxy.

    the reverse proxy hands all incoming connections and based on HTTP headers would direct to the LAN server you set it yo.


Log in to reply