Live data from Hacker News

Nginx Development Guide

nginx.org

31–39 of 39 posts

Re: Nginx Development Guide

#31
post #19

Earlier quoted context omitted.

So I've been slowly moving from nginx to Caddy in new projects (old projects still use nginx). The reasons for this are: 1. Automatic ACME integration in Caddy compared to the mess of containers something like nginx-proxy-manager is or the unreliability of external solutions like certbot or acme.sh 2. nginx's config. Footguns like if are well known, but even just if you want to deploy a nginx server with virtual host…

> did you know that if there is no Host header nginx serves the site evaluated first in its config file (even if the site has a server_name directive)? Before that it goes to the one named "" and if that doesn't exist, the one with default_server. If traffic with no Host header went to no server by default, people would also call that a footgun...

Setting a server_name is something you need to opt into. So I feel it should be required to match to serve that vhost. If you didn't want it to apply only to the right vhost, don't configure it to require a specific vhost?

Re: Nginx Development Guide

#32
post #26

hahaha so fitting... I've been struggling with an nginx configuration for two days now. I'm just about to try Caddy...

Caddyfile have easier syntax imho. Now, I wonder how does it compares to traefik..

If you are using caddy in k8s or docker (compose), you are wasting time. Traefik can be configured in almost every way via labels on pods/containers. It's also frustrating that you have to compile plugins into caddy to use them.

Re: Nginx Development Guide

#33
post #26

hahaha so fitting... I've been struggling with an nginx configuration for two days now. I'm just about to try Caddy...

Caddyfile have easier syntax imho. Now, I wonder how does it compares to traefik..

Caddy is more like a traditional web server. It does serve files while it’s not possible by default with traefik for example.

Re: Nginx Development Guide

#34
post #15

These days I'd rather develop on Caddy than Nginx.

> These days I'd rather develop on Caddy than Nginx. do you mean develop on Caddy itself or use Caddy as a webserver for a website you're developing?

I meant developing on Caddy itself. Since it is in Go, it would be remarkably easier than smashing out (async) C. Caddy also has a plugin/module architecture as well.

Re: Nginx Development Guide

#35

There are a few additional ways to extend nginx without writing a module in C. - JavaScript: https://nginx.org/en/docs/njs/ and https://github.com/nginx/njs-examples - Lua: https://github.com/openresty/lua-nginx-module - Rust: https://github.com/nginxinc/ngx-rust

I've been interested in learning OpenResty (which is based on the lua-nginx-module). Anybody knows of any interesting codebase using it?

Re: Nginx Development Guide

#36

There are a few additional ways to extend nginx without writing a module in C. - JavaScript: https://nginx.org/en/docs/njs/ and https://github.com/nginx/njs-examples - Lua: https://github.com/openresty/lua-nginx-module - Rust: https://github.com/nginxinc/ngx-rust

Don't forget Perl.

- Perl: https://nginx.org/en/docs/http/ngx_http_perl_module.html

Re: Nginx Development Guide

#37
post #26

Earlier quoted context omitted.

Caddyfile have easier syntax imho. Now, I wonder how does it compares to traefik..

If you are using caddy in k8s or docker (compose), you are wasting time. Traefik can be configured in almost every way via labels on pods/containers. It's also frustrating that you have to compile plugins into caddy to use them.

I disagree, Caddy works great in Docker. See https://caddyserver.com/docs/running#docker-compose, and CDP is a project that autoconfigures Caddy from labels https://github.com/lucaslorentz/caddy-docker-proxy. Regarding plugins, it's super simple to write a Dockerfile to add plugins, we ship a builder image variant that can be used to compile in any plugins you want.

Re: Nginx Development Guide

#38
post #28

These days I'd rather develop on Caddy than Nginx.

I got caught in the hype and switched to caddy. After a year I'm now back with nginx and happier than ever. I understand that one can probably methodologically master caddy, but from the perspective of someone who has been running web servers for decades and just needs to get things done, my god, caddy has the worst documentation of any product I've ever seen, and the most confusing configuration I can possibly imagi…

I greatly disagree regarding our docs. Typically the problem is you haven't read https://caddyserver.com/docs/caddyfile/concepts first which is required to understand where things go. If you're confused, you should ask us for help. Don't just let frustrations simmer. Ask a question on our forums https://caddy.community.
Post reply on HN