Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker.

Load Balancing A Docker Swarm Cluster With An NGINX Reverse Proxy

If you’ve been working towards containerizing your web applications like I have, you might be at a point where you’re ready to start clustering your containers. Previously I had written about creating a container cluster with Docker Swarm and using NGINX as a reverse proxy for a few containers. The catch here is that neither of these previous tutorials were meant to work together. In the previous example we were using a reverse proxy for containers on a single server. While Docker Swarm offers it’s own load balancing, you’ll find it makes sense to have NGINX as well because not every container can run on the host as port 80.

We’re going to see how to create two service containers that are replicated across several nodes. These services will be a simple Apache and NGINX web applications. Then we’re going to throw an NGINX reverse proxy into the mix that keeps track of the upstream nodes for its own load balancing.

Read More

Use NGINX As A Reverse Proxy To Your Containerized Docker Applications

You might have noticed that I’m doing quite a bit of Docker related articles lately. This is because I’ve been exploring it as an option for the future of my personal web applications. As of right now I’m serving several web applications on Digital Ocean under a single Apache instance. As requests come into my server, Apache routes them to the appropriate application via virtual hosts. Each application is a different directory on the virtual private server (VPS). If I were to containerize each application, things would behave a bit differently. I would need to set up a reverse proxy to route each request to a different container on the host.

While Apache can work as a reverse proxy, there are other options that work way better. For example NGINX is known for being an awesome reverse proxy solution. We’re going to see how to create several web application containers and route between them with an NGINX reverse proxy container.

Read More