skip to content
Notes && Anecdotes
Photo by Taylor Vick on Unsplash. There's some generic servers and cables on the image. Lighting is dark and mystic.Photo by Taylor Vick on Unsplash. There's some generic servers and cables on the image. Lighting is dark and mystic.

Nginx - why would I use it?

nginxinfrastructure

I talked to a consultant that suggested using nginx for serving our express applications (running in own pods in kubernetes). I didn’t quite understand why, but since it was a sidenote I didn’t inquiry to why (or have the confidence to do so).

So what’s Nginx really?

A reverse proxy

A reverse proxy accepts requests from the internet and routes it to the server that should reply. Like a bastion host, it can then be a signle point of security breaches, so it may be hardened, while other servers can “relax” internally.

In other words, Nginx can be exposed to the internet so your services don’t have to.

Comment: Cool. We don’t really need that however, as we already use Apollo Router as our functioning reverse proxy.

A load balancer

Nginx can also be set up to do a round-robin or weighted load balancing, handling having multiple servers with a shared responsibility and endpoint. It can do health checks against your servers to determine if they’re still capable of handling new requests.

Comment: Nice, but isn’t that already handled well as we use Kubernetes?

HTTPS termination

Nginx can be handle HTTPS termination for your website.

Comment: Neat. We have an AWS ELB that does this though.

Serving static files

Nginx can serve your static files, such as HTML/JS, images.

Comment: Solid, but we run a NextJS app on Vercel. Media uploaded files are served from S3.

Serve video streams

Stream video to users is also a part of Nginx’s capabilities.

Comment: Fancy, but we don’t do that. And we still got S3.

Summary

Nginx seems great. I’m still in the blue on our motivation for using it, and why the consultant wound recommend it. I’ll ask next time, I’m sure there some Kubernetes + Nginx interplay I don’t understand yet, like the Nginx Ingress Controller.