OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • English Forums »
  • Web Proxy Filtering and Caching (Moderator: fabian) »
  • Nginx as reverse proxy
« previous next »
  • Print
Pages: [1]

Author Topic: Nginx as reverse proxy  (Read 7735 times)

travelback

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Nginx as reverse proxy
« on: December 23, 2018, 01:25:57 am »
Hi, I'm setting up Nginx as a reverse proxy in 18.7.9 and can't get the setup to work. I have three servers setup, but only one works as expected. I'm not load balancing.

Here is a list of my settings:

Location (points to upstream server)
Description     URL Pattern      Match Type
Server 1         /                      Case Insensitive
Server 2         /                      Case Insensitive
Server 3         /                      Case Insensitive


HTTP Server (points to location)
Description     Ports               Real IP Source               Server Name
Server 1         80/443            X-Forwarded-For            xxxx.xxx
Server 2         80/443            X-Forwarded-For            xxxx.xxx
Server 3         80/443            X-Forwarded-For            xxxx.xxx


Upsteam Server
Description     Server                   Port        Server Priority
Server 1         xxx.xxx.xxx.xxx     ####    1
Server 2         xxx.xxx.xxx.xxx     ####    1
Server 3         xxx.xxx.xxx.xxx     ####    1


Upstream (points to server entry)
Description     PROXY Protocol
Server 1         checked
Server 2         checked
Server 3         checked

What am I missing??
Logged

fabian

  • Moderator
  • Hero Member
  • *****
  • Posts: 2769
  • Karma: 200
  • OPNsense Contributor (Language, VPN, Proxy, etc.)
    • View Profile
    • Personal Homepage
Re: Nginx as reverse proxy
« Reply #1 on: December 23, 2018, 08:41:14 am »
You probably have set up a load balancer setup because if I understand that correctly, you have multiple servers in your upstream. All servers in your upstream must behave exactly the same way (and the servers must be able to serve all pages if needed if you group then in an upstream).
Logged

travelback

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Re: Nginx as reverse proxy
« Reply #2 on: December 25, 2018, 05:46:18 am »
Quote from: fabian on December 23, 2018, 08:41:14 am
You probably have set up a load balancer setup because if I understand that correctly, you have multiple servers in your upstream. All servers in your upstream must behave exactly the same way (and the servers must be able to serve all pages if needed if you group then in an upstream).

I do have multiple servers, but they serve separate content. How do I set this up and not load balance?

As an example setup

Server 1 needs access to port 80/443 for a wordpress site and port 8080 for an admin panel
Server 2 needs access to port 80/443 for a moodle site and port 57362 for database management.
Logged

fabian

  • Moderator
  • Hero Member
  • *****
  • Posts: 2769
  • Karma: 200
  • OPNsense Contributor (Language, VPN, Proxy, etc.)
    • View Profile
    • Personal Homepage
Re: Nginx as reverse proxy
« Reply #3 on: December 25, 2018, 08:44:08 am »
You need to create some upstream servers:

name: IP Port Priority
wordpress_server: server_1_ip 80 1
adminpanel_server: server_1_ip 8080 1
moodle_server: server_2_ip 80 1
dba_server: server_2_ip 57362 1

Next step: create an upstream for each server - you cannot reuse it because you are running a single web site/application behind a IP and port combination.

Next step: assign the right upstream to the location blocks of your configuration.

Now it should work.
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • English Forums »
  • Web Proxy Filtering and Caching (Moderator: fabian) »
  • Nginx as reverse proxy
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2