3 ms·
Curious whether anyone else has run into the problem where Nginx fails to work and crashes the entire instance because a single app that it's supposed to revers
by KronisLV 4y ago
Curious whether anyone else has run into the problem where Nginx fails to work and crashes the entire instance because a single app that it's supposed to reverse proxy doesn't resolve:
nginx: [emerg] host not found in upstream "my-app"
In my eyes, that's a massive pain when you're running something like Docker Swarm with container health checks that don't route traffic to dynamically added internal names before the actual health checks for the containers have passed successfully. This probably isn't specific just for Docker Compose but also other solutions that handle networking similarly.
I wrote more about it on my blog: https://blog.kronis.dev/everything%20is%20broken/nginx-configuration-is-broken https://blog.kronis.dev/everything%20is%20broken/nginx-confi...
The sad thing is that using variables for that proxy_pass URL doesn't work either, when you want to use "proxy_redirect default", without which some applications that you're hosting tend to fail due to weird redirects:
nginx: [emerg] "proxy_redirect default" cannot be used with "proxy_pass" directive with variables
Alas, I'm in the weird spot where I cannot use Nginx for certain deployments, say, proxying 10-20 apps on my server but wanting most of them to keep working when one fails, without resorting to something like Kubernetes for managing the ingress due to some pretty tight resource limitations (even with stuff like K3s).
In comparison, Caddy is a little bit more usable, but also not quite as battle tested. Actually, Apache2/httpd might also be a viable alternative due to mod_md adding support for Let's Encrypt built in (like Caddy, unlike Nginx which needs certbot), if not for the performance.
Then again, the code that I write is the bottleneck more often than the actual web server, except for cases where one might use mod_php instead of fpm (though if you need to work with PHP and Apache and can afford the little extra work of configuring fpm, it's not too hard to fix either).