Nginx reverse proxy multi master architecture


This entry is part 1 of 2 in the series Nginx reverse proxy multi master

SystemMen - 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
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.

Conclusion

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.

Continue reading the seriesNext part: Prepare resources for nginx reverse proxy servers »»


«« »»