Welcome! Log In Create A New Profile

Advanced

Re: One NGINX server to 2 backend servers

Francis Daly
March 04, 2017 03:46AM
On Fri, Feb 24, 2017 at 06:17:51AM -0500, p0lak wrote:

Hi there,

> I want to define this behavior
>
> NGINX Server (Public IP) >>> listening on port 80 >>> redirect to a LAN
> Server on port 80 (http://mylocalserver/virtualhost1)
> NGINX Server (Public IP) >>> listening on port 81 >>> redirect to a LAN
> Server on port 80 (http://mylocalserver/virtualhost2)

Some of the terms you use here do have specific meanings in a http
context, and it may or may not be the case that you mean the same thing.

For clarification:

if you access your two internal web areas directly, do you access
things like

http://servername/directory1/ and http://servername/directory2/

or

http://servername1/ and http://servername2/

?

(You do say the first; but the term "virtual host" would usually refer
to the second. And the nginx config will differ depending on which it is.)

If it is the first, then it is probably easier for you just to have
nginx listening on public port 80, and accept requests for /directory1/
and /directory2/ and proxy_pass them as-is to the internal server.

If instead you want one nginx listener on port 80 and another on port 81,
then you will possibly have to make sure that the internal web areas
are happy with being proxy_pass'ed like that -- they may need extra
configuration to know the public url that refers to them if they create
absolute urls within the html they return, for example.

Cheers,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

One NGINX server to 2 backend servers

p0lak February 24, 2017 06:17AM

Re: One NGINX server to 2 backend servers

pratyush February 26, 2017 12:58AM

Re: One NGINX server to 2 backend servers

p0lak February 27, 2017 09:26AM

Re: One NGINX server to 2 backend servers

pratyush February 27, 2017 09:52AM

Re: One NGINX server to 2 backend servers

Rajeev J Sebastian February 27, 2017 12:00PM

Re: One NGINX server to 2 backend servers

p0lak March 02, 2017 05:17AM

Re: One NGINX server to 2 backend servers

Francis Daly March 04, 2017 03:46AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 176
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready