3 ms·
A load balancer shouldn't serve static files. It shouldn't serve anything. It should... load balance. I can see why you'd want an all-in-one solution sometime
by kelnos 3y ago
A load balancer shouldn't serve static files. It shouldn't serve anything. It should... load balance.
I can see why you'd want an all-in-one solution sometimes, but I also think a single-purpose service has strengths all its own.
- CoolCold 3y agoQuite intersting - in theory, "pure" load balancer shouldn't not, but in practice most of my LBs, especially for small projects do. Even for larger projects I do combine proxy_cache on LB making it serve static files or using to serve websites public content and splitting load over several application servers for dynamic content. And I think it's fine.
- nickjj 3y agoFor a lot of web apps, having an all-in-one solution makes sense. nginx open source does all of these things and more wonderfully: Reverse proxying web apps written in your language of choice 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[0], 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 I wouldn't want to run and manage services and configs for ~10 different tools here but nearly every app I deploy uses most of the above. nginx can do all of this with a few dozen lines of config and it has an impeccable track record of being efficient and stable. You can also use something like OpenResty to have Lua script support so you can script custom solutions. If you didn't want to use nginx plus you can find semi-comparable open source Lua scripts and nginx modules for some individual plus features. [0]: Technically this is an open source module to provide this feature.