• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Multiple Domains + Multiple Webservers

Scheduled Pinned Locked Moved General pfSense Questions
8 Posts 7 Posters 5.4k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    Jonatino
    last edited by Mar 15, 2016, 2:45 AM

    My dad currently is hosting his website on port 80 and I'd like to host my own webserver on my computer.

    Is it possible with pfsense to forward a specific domain to a specific local ip?

    Example:
    www.dadswebsite.com -> 192.168.0.22
    www.mywebsite.com -> 192.168.0.33

    Thanks!

    1 Reply Last reply Reply Quote 0
    • J
      johnpoz LAYER 8 Global Moderator
      last edited by Mar 15, 2016, 11:58 AM

      with the use of a reverse proxy sure..

      Or using www.yourdomain.tld:81 or some other port as the dest port your clients connect to.. Then you can have pfsense forward that to a different IP on port 80 if you want.

      An intelligent man is sometimes forced to be drunk to spend time with his fools
      If you get confused: Listen to the Music Play
      Please don't Chat/PM me for help, unless mod related
      SG-4860 24.11 | Lab VMs 2.7.2, 24.11

      1 Reply Last reply Reply Quote 0
      • M
        marvosa
        last edited by May 28, 2016, 7:37 PM Mar 15, 2016, 8:45 PM

        Adding on to what johnpoz already noted, you can either:

        • Configure a reverse proxy using one of the packages on PFsense

        • Use port forwarding and host each site on a different port

        • Forward port 80 to a linux box, install squid, and configure squid as a reverse proxy

        • Host both sites on the web server and configure the server to listen for the host header instead of the IP

        1 Reply Last reply Reply Quote 0
        • J
          johnpoz LAYER 8 Global Moderator
          last edited by Mar 15, 2016, 11:21 PM

          4 is how u would do it most of the time.  But op clearly stated different webservers is why i didnt mention it.  But it is how i would do it

          Another option is get another public ip

          An intelligent man is sometimes forced to be drunk to spend time with his fools
          If you get confused: Listen to the Music Play
          Please don't Chat/PM me for help, unless mod related
          SG-4860 24.11 | Lab VMs 2.7.2, 24.11

          1 Reply Last reply Reply Quote 0
          • D
            Derelict LAYER 8 Netgate
            last edited by Mar 16, 2016, 12:18 AM

            @marvosa:

            Adding on to what johnpoz already noted, you can either:

            • Configure a reverse proxy using one of the packages on PFsense

            • Use port forwarding and host each site on a different and port

            • Forward port 80 to a linux box, install squid, and configure squid as a reverse proxy

            • Host both sites on the web server and configure the server to listen for the host header instead of the IP

            5. Get more IP addresses.

            Chattanooga, Tennessee, USA
            A comprehensive network diagram is worth 10,000 words and 15 conference calls.
            DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
            Do Not Chat For Help! NO_WAN_EGRESS(TM)

            1 Reply Last reply Reply Quote 0
            • C
              codemaster
              last edited by Mar 16, 2016, 2:00 AM

              If i may add to what my friend johnpoz and Derelict points,

              Another approach to your situation is to bundle or configure both website to use only 1 server . Be it Apache/Lighttpd/Nginx/IIS can accept multiple domain on single IP address (regardless dynamic IP address or static IP address on WAN).

              By doing that, you save multiple ports to port foward from pfsense to internal IP. All you need to do is to configure your dad website's and your website into a single machine (server) and write the Virtualhost blocks for the domain(s) that you want it inside the webserver software that you use. An A record on both of your domain control panel should point to your current WAN IP and thus the webserver will handle the domain(s) and points to the respective folder to serve files from.

              Unless of course there's no other way around it and you have to use 2 machine (servers) then you will need to follow what johnpoz and Derelict pointed out in the previous post.

              Regards

              I'm a Firewall, Router and Opensource Enthusiast.

              My Blog

              1 Reply Last reply Reply Quote 0
              • G
                genic
                last edited by May 28, 2016, 7:26 PM

                with everything that has been stated ….so in summarization...the follow is NOT possible with a SINGLE external IP address?

                pfsense to forward a specific domain (SEPARATE servers to a specific local ip?)

                Example:
                www.dadswebsite.com -> 192.168.0.22
                www.mywebsite.com -> 192.168.0.33

                .....without adding any reverse proxies, or add-on packages...

                1 Reply Last reply Reply Quote 0
                • K
                  kpa
                  last edited by May 28, 2016, 7:31 PM

                  No, not possible with just standard NAT. The reason is that PF has no means to inspect the payloads of the data packets that are flowing trough the packet filter, to do redirections based on the destination hostname part of the HTTP headers you'd have to know what's inside those payloads.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                    This community forum collects and processes your personal information.
                    consent.not_received