Live data from Hacker News

Caddy – The HTTP/2 Web Server with Automatic HTTPS

caddyserver.com

21–30 of 66 posts

Re: Caddy – The HTTP/2 Web Server with Automatic HTTPS

#21
post #7

When Caddy was first released I tried, and failed, to get Caddy to serve an https site locally . Is that possible now? The docs[1] hint that it could be if I add an entry to my hosts file pointing an IP address of, say, a Docker container, as that wouldn't technically be localhost or an IP address. It doesn't explicitly say it's possible though. Adding something to the tutorials would be immensely helpful if it does…

What do you mean by locally? If you want HTTPS automatically then the site must be publically available so that LetsEncrypt can verify the domain and grant the certificate. If that's not possible then you'll have to use the DNS challenge and setup a provider plugin. It doesn't matter where the backend points and you can use it to serve a docker container if you want, but that's different from the the host/frontend ad…

Locally in the sense of a local development server. The issue is that there wouldn't be a real DNS record pointing at the machine (well, unless you added one to point at your external IP address, but that's a pain for teams). I guess if Let's Encrypt needs to verify the domain it won't be possible...

Re: Caddy – The HTTP/2 Web Server with Automatic HTTPS

#22
post #15

Has there been a shift in the recent times regarding developer teams paying for software? Yes, ease-of-use is great benefit. It takes a while to become accustomed to nginx configuration. But, $25/instance/month for a web server when nginx can do almost everything (and arguably much better than a server that was only launched two years ago)? It doesn't sit with me well.

It's open source, right? Just compile it yourself? To your lager point, I think paying for software is and has been the norm in many places. So nothing new.

I didn't notice that you can compile the source code yourself to avoid paying for the license. That seems to be a nice alternative.

Re: Caddy – The HTTP/2 Web Server with Automatic HTTPS

#23
post #21

Earlier quoted context omitted.

What do you mean by locally? If you want HTTPS automatically then the site must be publically available so that LetsEncrypt can verify the domain and grant the certificate. If that's not possible then you'll have to use the DNS challenge and setup a provider plugin. It doesn't matter where the backend points and you can use it to serve a docker container if you want, but that's different from the the host/frontend ad…

Locally in the sense of a local development server. The issue is that there wouldn't be a real DNS record pointing at the machine (well, unless you added one to point at your external IP address, but that's a pain for teams). I guess if Let's Encrypt needs to verify the domain it won't be possible...

Then you need to acquire the certificate yourself. Or just use a self-signed certificate since it's your own machine....

Re: Caddy – The HTTP/2 Web Server with Automatic HTTPS

#24
post #15

Has there been a shift in the recent times regarding developer teams paying for software? Yes, ease-of-use is great benefit. It takes a while to become accustomed to nginx configuration. But, $25/instance/month for a web server when nginx can do almost everything (and arguably much better than a server that was only launched two years ago)? It doesn't sit with me well.

It's open source, right? Just compile it yourself? To your lager point, I think paying for software is and has been the norm in many places. So nothing new.

> It's open source, right? Just compile it yourself?

The point was that it was easy to install and get it running. Your point defeats the purpose of Caddy in the first place.

It would be much easier to:

1. `sudo apt-get install nginx-extras python-certbot-nginx`

2. Add simple config with 80 port of your website/reverse proxy.

3. `sudo certbot --nginx`

4. Do not worry that you will be sued by nginx for using it for commercial purposes.

Re: Caddy – The HTTP/2 Web Server with Automatic HTTPS

#25
post #7

When Caddy was first released I tried, and failed, to get Caddy to serve an https site locally . Is that possible now? The docs[1] hint that it could be if I add an entry to my hosts file pointing an IP address of, say, a Docker container, as that wouldn't technically be localhost or an IP address. It doesn't explicitly say it's possible though. Adding something to the tutorials would be immensely helpful if it does…

You can't use automatic https locally, but can use a self signed certificate by adding `tls self_signed`

Re: Caddy – The HTTP/2 Web Server with Automatic HTTPS

#27
post #5

They make it quite hard to find out, but here it is: > Caddy obtains certificates for you automatically using Let's Encrypt. Not sure why that is not stated front and centre. It's a good idea.

That’s literally the first selling point in 128px font. [1]

It might not mention the implementation details but the concept is what matters.

[1] https://i.imgur.com/hdEaKpG.jpg

Re: Caddy – The HTTP/2 Web Server with Automatic HTTPS

#28
post #9

What's interesting is that it's the first web server not focused on speed or performance but on the user experience. I love nginx, but I had huge headaches configuring it when migrating php apps with huge htaccess rules to nginx. The terms of the license do not seem super clear though.

I've been putting off deploying one of my side projects because I'm afraid that I'll mess up an existing site if I touch the nginx config again. Caddy looks promising and simpler. Might have to take a look this weekend.

How is your configuration managed that this is a concern? While I generally have a whole different conf for each site run and include the directory with them in the main nginx file, you should at least have them in different blocks, even if in a monolithic config. I don't quite understand how you think you're going to break any other site.

Even if you do manage to screw up the config, just do 'nginx -s reload' - this verifies the syntax of the config and then attempts to apply it. If it is successfully applied, (e.g. dns is resolvable for listed upstreams, etc etc etc) then launches new worker processes, and then messages old worker processes running the old config to not accept any new requests (so all go to the new workers) and to shut down after finishing handling any existing requests. If it fails to apply, old workers stay up and keep running with the old config.

Re: Caddy – The HTTP/2 Web Server with Automatic HTTPS

#29
post #12
post #6

That's interesting! I wonder how it scales relative to, say, nginx.

It scales fine… if you don’t already know the answer to that question, none of the web servers you choose are the bottle-neck to your site. ;-)

That's a bizarre statement. I could be incredibly familiar with nginx, apache, varnish, etc., and have a website that scales to a huge amount of users and still have no idea how well Caddy scales compared to nginx due to having no prior knowledge of Caddy's performance. Indeed, questions about scaling and performance are going to be some of the very first questions asked by anyone running such a site - that's going to be one of the single most important characteristics about it. (Hopefully after security....)

Re: Caddy – The HTTP/2 Web Server with Automatic HTTPS

#30
post #15

Earlier quoted context omitted.

It's open source, right? Just compile it yourself? To your lager point, I think paying for software is and has been the norm in many places. So nothing new.

> It's open source, right? Just compile it yourself? The point was that it was easy to install and get it running. Your point defeats the purpose of Caddy in the first place. It would be much easier to: 1. `sudo apt-get install nginx-extras python-certbot-nginx` 2. Add simple config with 80 port of your website/reverse proxy. 3. `sudo certbot --nginx` 4. Do not worry that you will be sued by nginx for using it for co…

Installing Caddy is easy. https://github.com/mholt/caddy#build

Init scripts are included as well, both for FreeBSD, macOS and for a several different init systems used by various Linux distros. https://github.com/mholt/caddy/tree/master/dist/init

FreeBSD even has it in the ports collection, so you can install it using the package manager that is included with FreeBSD

    doas pkg install caddy
Once installed on FreeBSD with the above command, create a configuration file in the Caddyfile format in /usr/local/www/Caddyfile. Example Caddyfile:

    www.mysite.com {
        root /var/www/com.mysite.www
    }

    mysite.com {
        redir https://www.mysite.com{uri}
    }

    sub.mysite.com {
        root /var/www/com.mysite.sub
        gzip
        log /var/log/com.mysite.sub/access.log
    }
Provide an SSL certificate issuer email in your rc.conf. By providing an email address you automatically agree to letsencrypt.org's general terms and conditions:

    doas sysrc caddy_cert_email="your.email@example.org"
Enable caddy in your rc.conf:

    doas sysrc caddy_enable="YES"
Start the server:

    doas service caddy start
> Do not worry that you will be sued by nginx for using it for commercial purposes.

The source code of Caddy is distributed under the terms of the Apache 2.0 license.

https://github.com/mholt/caddy/blob/master/LICENSE.txt

Post reply on HN