Nginx reverse proxy multi master architecture

by Daniel Pham
Published: Updated:
This entry is part 1 of 2 in the series Nginx reverse proxy multi master

Nginx reverse proxy is increasingly used with the same solution as HAproxy. But how to install nginx reverse proxy multi master? You can find many articles that teach the use of Keepalived to increase the availability of nginx reverse proxy systems. This article will upgrade that to make your system more responsive.

Requirements set out

The installation of nginx reverse proxy is quite simple, but most of the instructions are less referring to running a multi master server. Most tutorials use Keepalived and set up two servers: Master - Backup to back up each other.

This means that at one point only one nginx proxy server processes requests.

In case your system starts getting bigger, the nginx proxy server starts to overload. What will you do? You will increase the RAM, increase the CPU for it. I guess so.

In those cases, you will want to have a nginx reverse proxy multi master system. Just like you can run multiple server backends at the same time. Now, you can run multiple nginx proxy servers at the same time and the request will be processed by all proxies.

Nginx reverse proxy multi master – system architecture

I would like to mention architecture instead of going into installation immediately. That will make it easier to access the installation steps in the next article of the series.

I drew a logic diagram that makes it easy to imagine. As you can see, in my image I use two nginx proxy servers; However, with this architecture, you can increase the number to 3 or 4 or more according to your needs.

Nginx reverse proxy multi master architecture
Nginx reverse proxy multi master architecture.

On each server nginx, I will install the important packages include:

  • Nginx
  • HAproxy
  • Keepalived

How do these software work together? Most people just think that they spend HAproxy or just use Nginx proxy, because these two software have the ability to do reverse proxy the same.

In it, the components work as follows:

  • Nginx will have the main task of forwarding requests to server backends with the round robin method.
  • HAproxy will have the main task of forwarding the requests received on the Virtual IP to the Nginx servers with the round robin method.
  • Keepalived will have the main task of checking the status of the HAproxy service, still using the Master - Multi Backup model to assign the Virtual IP to the HAproxy servers.


In this section I will stop at the architecture part of the system. In the next article, I will cover the preparation of the server so that we can install a system according to the drawing architecture.

(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).

0 0 votes
Article Rating
Series NavigationNext part: Prepare resources for nginx reverse proxy servers »»

You may also like

Notify of
Inline Feedbacks
View all comments

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.



Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 – All rights reserved.

Please write sources “” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Would love your thoughts, please comment.x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.