Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Caddy as a server type #60

Open
francislavoie opened this issue Oct 8, 2017 · 5 comments
Open

Support Caddy as a server type #60

francislavoie opened this issue Oct 8, 2017 · 5 comments

Comments

@francislavoie
Copy link

I can help with the implementation or any questions, but I'm not sure where to start

@danhunsaker
Copy link
Contributor

Can't say I'm familiar with Caddy. First thing would be an overview of what we'd be dealing with/looking at.

@francislavoie
Copy link
Author

francislavoie commented Oct 8, 2017

https://caddyserver.com/

Works similarly to nginx, but has a ton of unique features not available (without extensions) in nginx like automatic SSL (gets an SSL cert from Let's Encrypt on the fly on server startup), etc.

A simple Caddyfile for a PHP site is (usually) as simple as:

https://{{hostname}} {
    root /var/www/web
    fastcgi / 127.0.0.1:9000 php
    rewrite {
        to {path} {path}/ /index.php?{query}
    }
}

Uses php-fpm with the fastcgi Caddyfile directive, so you can reuse all the stuff you have to run PHP with apache/nginx.

See https://hub.docker.com/r/abiosoft/caddy/ for a container built from source (must be built from source, because the pre-built binaries require a license if used commercially)

@danhunsaker
Copy link
Contributor

The automatic HTTPS bit will probably cause issues with Nanobox, actually, but we can explicitly disable that pretty simply in the config template we would create for this. In production, SSL is terminated at the load balancer, not the web server, so Caddy wouldn't ever actually see a request to 443.

What else sets it apart if we disable the auto SSL? I think we can definitely add it to our list of things to support, but it would be nice to be able to give users some guidance on when to use which server, and what restrictions the Nanobox design will place on the actual features they'll be able to take advantage of.

@francislavoie
Copy link
Author

Check https://caddyserver.com/features for a pretty comprehensive list.

Caddy can be used as a load balancer itself, which can terminate SSL and automatically renew, if that would work in the stack.

Disclaimer: I don't actually use nanobox, just saw it via Hacktoberfest and thought I'd bring this up as a potential addition because Caddy is feeling like the #3 webserver these days. I use it in most of my projects because of its ease of use and features that simplify lots of the usually complicated server tasks (e.g. SSL).

@danhunsaker
Copy link
Contributor

danhunsaker commented Oct 8, 2017

It certainly looks nice. We use Go in a lot of our own stack, in fact, including for the CLI client. Our load balancer/SSL terminator/router is kernel-level, IIRC, and configured on the fly via API, so it's very fast and handles changes in app infrastructure very cleanly on the fly. So I don't think we'd want to switch to Caddy on that level.

That said, it certainly looks like something to support for app-level use! Thanks for bringing it up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants