The NGINX SPRINT 2.0 event just finished, and it really opened my eyes to how much of a world there is to NGINX outside of my current experience with it, which has been using the open-source version of NGINX, as well as the Kubernetes NGINX Ingress Controller.
I’m primarily a freelance developer and sysadmin who does contract work for smaller-sized companies and individuals and I’ve been using the open-source version of NGINX since about 2012.
In this post, we’ll briefly cover a few features available when using the open-source version of NGINX – specifically, when you’re not operating at intergalactic web scale. Perhaps it’s to help serve traffic for an app that gets a few million page views a month, but it could really be any number. I picked a few million because that’s the scale I typically operate at.
For each application, I mostly deal with running NGINX on one or a few servers while handling its configuration with Ansible. This helps me set things up for each project in such a way that all I have to do is set a few config options and everything I need at the NGINX / web server level is customized for that specific application.
NGINX is a Swiss Army Knife
It’s technically a web server and over the years I’ve used it for:
- Reverse proxying various web apps written in Python, Ruby, Elixir and Node
- Load balancer
- Rate limiting
- TLS termination (serving SSL certificates)
- Redirecting HTTP to HTTPS and other app-level redirects
- Serving static files with cache headers
- Managing a deny / allow list for IP addresses
- Getting geolocation data, such as a visitor’s country code, and setting it in a header
- Serving a maintenance page if my app back-end happens to be down on purpose
- Handling gzip compression
- Handling websocket connections
That’s not an exhaustive list of NGINX features either. These are all things I use in my day-to-day. What’s amazing is you can get all of that functionality in about 150 lines of configuration. That’s not a half-baked implementation too, this is a production-ready configuration that can be used to serve traffic for any type of web app back-end.
It doesn’t matter if you’re using Flask, Rails, Django, Phoenix, Node, Play, Laravel, Go, or something else, NGINX is one of those tools where the technical payoff vs time spent learning it is nearly unrivaled. It doesn’t matter what your tech stack is, chances are you’re going to be using NGINX. When it comes to using it with a Rails app or a Flask app, 99% of the configuration is the same. You might decide to change minor things like the static file location path, but that’s it.
I hate to throw around terms like “empowering” because it sounds like marketing fluff but that’s really how I feel as a solo developer. I can learn NGINX once and it follows me along with any tech stack while never causing a fuss.
Sure, my configuration has evolved over the years but a lot of it hasn’t changed that much. I don’t know how Igor (the creator of NGINX) does it but he, along with the rest of the open-source contributors, have created a wonderful piece of technology with an extremely stable configuration API.
It’s usually the most lightweight, efficient, and dependable part of my stack. I don’t know what else to say other than I’m thankful we live in a world where tools like this exist. I have nothing to pitch here. I’m just passionate about the tools that I use and NGINX is on a very short list of tools that have earned my trust for life.
Learn more about NGINX’s products by watching the on-demand sessions from the NGINX Sprint 2.0 event.
Leave a Comment