Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Caddy seems to be a new cool HTTP server
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Caddy seems to be a new cool HTTP server

NixtrenNixtren Member
edited July 2015 in General

I just found this lightweight HTTP server called Caddy, with only ~3MB in size and low RAM usage (~2MB usage after startup here, idle, no PHP). I took a look at it's config file and it's really easy to set up stuff (including Virtual Hosts), no need for control panels anymore!

It also supports PHP via FastCGI, SSL and other cool stuff.

Have you tried it? What are your thoughts?

«1

Comments

  • AnthonySmithAnthonySmith Member, Patron Provider

    looks pretty nice, will give it a try, I was just looking at alternatives today as it happens.

  • Wow. Seems to be a nice alternative.

  • What does it do that lighttpd doesn't? lighttpd uses barely any RAM either and is easy to configure

  • TomTom Member

    Looks really nice!

  • BruceBruce Member

    Jetty is on my to-try list

  • DillybobDillybob Member
    edited July 2015

    How easy is it to add clean URL's, rate limiting, etc?

    Because if it's not easier than nginx.. not really worth it.. (And nginx is pretty easy itself :P)

    Edit: Caddy can pipe stdin and stdout from any program to WebSocket clients.

    That's pretty cool actually, but not sure about the performance here.

  • not really worth it

    This is it. I do admire lightweight-by-default apps though, looks promising. Might toy around with it when I get a few hours, thanks for sharing.

  • mholtmholt Member
    edited July 2015

    I saw some visitors coming from here, so I'll try to answer a few questions!

    What does it do that lighttpd doesn't? lighttpd uses barely any RAM either and is easy to configure

    I'd argue that Caddy is even easier to configure than lighttpd. Caddy is targeting a non-programmer/sysadmin audience more than lighttpd.

    Here's a few things Caddy can do that lighttpd can't:

    • HTTP/2 by default. I don't think lighttpd is even slated to support this in 1.x.
    • Scales across CPUs very well.
    • Cross-platform without any hassle. It just works.
    • Render markdown files on-the-fly (or pre-render the files for even faster service).
    • Deploy your site with git push.
    • Run commands on startup or shutdown (useful if proxying to backends like php-fpm).
    • No need to compile from source (all downloads are statically linked binaries meaning that there's no external C dependencies).
    • Programmable templates which are better than server-side includes. Templates can do more and are much easier to use.

    We're also working on direct integration with Let's Encrypt which means free, automatic SSL certificates for your site without any trouble.

    How easy is it to add clean URL's, rate limiting, etc?

    Clean URLs are one-liners: ext .html .txt for example. Rate limiting is on our to-do list. Would love some contributions on that front!

    Because if it's not easier than nginx.. not really worth it.. (And nginx is pretty easy itself :P)

    If you know how to program, nginx isn't too hard to configure, but even for programmers, setting up nginx just right can be a half-day project. It's not uncommon for a Caddyfile to be 1/3 the length of an equivalent nginx.conf file.

    Caddy can pipe stdin and stdout from any program to WebSocket clients. That's pretty cool actually, but not sure about the performance here.

    It's not great - like CGI, but for websockets (inspired by websocketd). Still, if you have a program that only knows stdin/stdout, this is a good way to go. Caddy can also proxy websocket connections to a WS backend.

    Might toy around with it when I get a few hours, thanks for sharing.

    Let me know if you change your mind after trying it. If you still think it's not worth it, do tell me about your experience and we'll try to improve Caddy.

  • netomxnetomx Moderator, Veteran

    Hmm... will try to check what's smaller, OpenWRT uhttpd or this one?

  • rm_rm_ IPv6 Advocate, Veteran

    My chief concern would be security issues. This project seems to be pretty new, it's obviously much less widely used and reviewed (and combed through for security holes) than Lighttpd or Nginx. Web server is the critical piece of software in this aspect, so it's not really the place where I would go for "new and cool" over reliable and well-tested.

    Thanked by 2alexvolk geekalot
  • Looks nice would try this on one of the dev vms, interested in trying git push feature :)

  • RalliasRallias Member
    edited July 2015

    hostnoob said: What does it do that lighttpd doesn't? lighttpd uses barely any RAM either and is easy to configure

    It doesn't memory leak on X-Sendfile and call it a feature.

    Thanked by 1netomx
  • mholtmholt Member

    rm_ said: My chief concern would be security issues. This project seems to be pretty new, it's obviously much less widely used and reviewed (and combed through for security holes) than Lighttpd or Nginx. Web server is the critical piece of software in this aspect, so it's not really the place where I would go for "new and cool" over reliable and well-tested.

    You're not the only one with that concern. Please pentest Caddy mercilessly. The sooner we work out any obvious or serious vulnerabilities, the sooner Caddy will be ready to be taken seriously.

    I know, for instance, that Caddy has yet to be fuzz-tested. I will do it eventually, if nobody beats me to it.

  • roykemroykem Member

    From the beginner guide it seems pretty easy to run this Caddy.
    I will try this on my NAT LEB box for sure.

    Thanks for let me know.

  • BlaZeBlaZe Member, Host Rep

    Time for some testing :D I call the benchmarking gods :3 to shed some light

  • Shot2Shot2 Member

    Gave it a try, "500 Internal Server Error", trashed. But hey I'm no "developer" that's why :)

  • tr1ckytr1cky Member

    Sorry, but no form of rate-limiting is a no-go. Please make this a high priority thing on your todo list and do it smart, that's also a way to outclass lighttpd easily, as their implementation of rate-limiting is pretty bad.

  • mholtmholt Member

    @Shot2 said:
    Gave it a try, "500 Internal Server Error", trashed. But hey I'm no "developer" that's why :)

    Feel free to open an issue and we can take a look at what went wrong. Be sure to post your Caddyfile, the request URL, and the system you're running on.

    @tr1cky said:
    Sorry, but no form of rate-limiting is a no-go. Please make this a high priority thing on your todo list and do it smart, that's also a way to outclass lighttpd easily, as their implementation of rate-limiting is pretty bad.

    I think we will step it up. Do you have any specific suggestions about rate limiting that you'd like to see? Or any methods in particular you think we should avoid? I'm listening.

  • tr1ckytr1cky Member

    mholt said: I think we will step it up. Do you have any specific suggestions about rate limiting that you'd like to see? Or any methods in particular you think we should avoid? I'm listening.

    There's a lot you could do, the nginx approach is already pretty good.

    • Possibility of defining different zones for rate-limiting, e.g. css files often trigger rate-limiting a lot more than other files so they'd need their own zone.

    • Add an option to ban IPs for a specified time after they exceed rate-limiting limits for x times.

    • Add a posibility to ban/unban rate-limited IPs via iptables and other firewalls automatically.

    • API implementation to automatically ban/unban IPs on popular CDN services like CloudFlare, Incapsula etc.

  • CloudconeCloudcone Member, Patron Provider

    PHP is done via fastcgi in Caddy....

  • perennateperennate Member, Host Rep

    Quadcone said: PHP is done via fastcgi in Caddy....

    As opposed to what?

  • FPM support is crucial, FastCGI performance is sub-par.

  • tested before , But It's some kind of minimal.
    No option for Load balancing.

  • perennateperennate Member, Host Rep
    edited July 2015

    William said: FPM support is crucial, FastCGI performance is sub-par.

    Is there an alternative protocol to connect to PHP-FPM other than FastCGI? As stated on the PHP-FPM website,

    PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites.

    Edit: see http://serverfault.com/questions/645755/differences-and-dis-advanages-between-fast-cgi-cgi-mod-php-suphp-php-fpm

    Thanked by 1deadbeef
  • FPM is not FastCGI per se, it is just based on it - In my experience the performance increases at around 15%

  • perennateperennate Member, Host Rep
    edited July 2015

    William said: FPM is not FastCGI per se, it is just based on it - In my experience the performance increases at around 15%

    FastCGI is a protocol. PHP-FPM uses FastCGI for communication with the web server. If Caddy supports FastCGI, then you can set it up to work with PHP-FPM.

    Unless you're saying that PHP-FPM offers an alternative protocol to FastCGI that is somehow faster than the default FastCGI interface that most people configure it to use.

    Edit: see e.g. https://godoc.org/github.com/mholt/caddy/middleware/fastcgi which mentions that Caddy's FastCGI middleware is most commonly used for PHP-FPM.

    Thanked by 2mholt deadbeef
  • Looks very promising. Will definitely give this a try soon.

  • mholtmholt Member
    edited July 2015

    danitfk said: tested before , But It's some kind of minimal.

    No option for Load balancing.

    Thanks for trying it out earlier. You should try it again. The proxy directive makes load balancing trivial, even as easy as one line in the Caddyfile. It supports health checks as well.

    I should add that the community is excellent and has contributed a lot to the project (load balancing is one example). It wouldn't be possible without that help!

    Thanked by 1mpkossen
  • you can Caddy as Windows Service?

  • netomxnetomx Moderator, Veteran

    @riopardo said:
    you can Caddy as Windows Service?

    ofc! Use https://support.microsoft.com/en-us/kb/137890

    Thanked by 1mholt
Sign In or Register to comment.