Welcome! Log In Create A New Profile

Advanced

Re: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

Francis Daly
October 16, 2018 03:58AM
On Tue, Oct 16, 2018 at 09:20:33AM +0200, Stefan Müller wrote:

Hi there,

> so I wonder, if I need to work with multiple .conf files or shall I put
> multiple http{} blocks in the general configuration of nginx
> /etc/nginx/nginx.conf? I assume that Reinis told me indirectly to run
> multiple instances of nginx, but I haven't understood yet how. There is the
> master process, properly taking care about the proxy server but how to I
> start the instance (if I need to work with instances) per /virtual host/?

In this design, you run multiple instances of nginx. That is: multiple
individual system processes that are totally independent of each other.

So: nginx-user1.conf includes something like

http {
server {
listen unix:/some/path/user1.sock;
}
}

and refers to log files and tmp files and a pid file that user1 can write,
and to a document root that user1 can read (if necessary), and you run
the command "/usr/sbin/nginx -c nginx-user1.conf" as system user user1.

And then you do the same for user2, user3, etc.

And then you have one other "nginx-main.conf" which includes "listen 443
ssl" and includes proxy_pass to the individual unix:/some/path/userN.sock
"backend" servers; and you run the command "/usr/sbin/nginx -c
nginx-main.conf" as user root.


Note: the actual file names involved are irrelevant. All that matters
is that when the nginx binary is run with a "-c" option, it can read
the named file which contains the config that this instance will use.

If the nginx process starts as user root, it will change itself to run as
the other configured user-id as soon as it can; if it starts as non-root,
it will not. In the above design, all of the user-specific backend nginx
servers run as non-root.


And - the term "virtual host" usually refers to different server{} blocks
within the configuration of a single nginx instance. You (generally) don't
care about those -- the nginx binary will start the appropriate child
system-level processes to deal with the configuration that it was given.

If you are running multiple nginx system-level processes, each one has
its own idea of the virtual hosts from its configuration. With the above
design, all of the "user" nginx instances have just one server{} block,
while the "root" nginx instance probably has multiple server{} blocks.


Good luck with it,

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

Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

PackElend September 21, 2018 02:36AM

Re: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

PackElend September 26, 2018 06:02AM

RE: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

Reinis Rozitis September 26, 2018 06:54AM

Re: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

PackElend September 26, 2018 07:06AM

Re: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

PackElend September 26, 2018 04:44PM

RE: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

Reinis Rozitis September 27, 2018 06:16AM

Re: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

PackElend September 28, 2018 01:02PM

RE: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

Reinis Rozitis September 28, 2018 02:50PM

Re: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

PackElend October 02, 2018 06:00AM

RE: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

Reinis Rozitis October 02, 2018 12:44PM

Re: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

PackElend October 02, 2018 02:34PM

RE: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

Reinis Rozitis October 02, 2018 08:10PM

Re: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

PackElend October 03, 2018 05:04PM

Re: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

PackElend October 07, 2018 03:44PM

Re: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

PackElend October 12, 2018 06:00PM

Re: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

PackElend October 14, 2018 04:02PM

Re: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

Francis Daly October 15, 2018 04:26PM

Re: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

PackElend October 16, 2018 03:22AM

Re: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

Francis Daly October 16, 2018 03:58AM

Re: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

PackElend October 16, 2018 03:24PM

Re: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

Francis Daly October 17, 2018 05:00PM

Re: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

PackElend October 19, 2018 05:28PM

RE: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

Reinis Rozitis October 22, 2018 04:52AM

Re: Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

Francis Daly October 23, 2018 02:02PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 189
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