Caddyfile questions

  1. Why the term ‘file server’? I think of Caddy as a web server. Am I missing something here?

  2. The examples show the directive ‘file_server’ being used, yet other examples by mholt on other
    websites do not use the file_server directive. Is this because ‘file_server’ is the default behavior?

  3. I downloaded sources and built the ‘development’ version as it was simpler. Is there a difference
    between the two versions? Do I need to care about the binary properly reporting version numbers,
    etc?

Thanks,

Joe

  1. A web server can serve all kinds of content, including files (static content), or dynamic content. A file is something like app.js or styles.css or even index.html. Dynamic content is something like PHP code being executed, or reverse proxying to some other server. In Caddy v2, you need to specify the file_server directive for static files to get served when requested.

  2. You might be looking at old examples from Caddy v1. Caddy v2 is much newer, so there aren’t as many examples out in the wild yet. Caddy v1 didn’t require a file_server directive, it was the implicit behaviour. In v2, it was decided to make it be explicitly configured because it’s not always necessary to have enabled. See the upgrade guide for some of the differences.

  3. Not really, no. Many people prefer to build from source, for various reasons, top reason being to compile in plugins. Any differences would come from having built from a commit later than the tagged release. There’s no guarantees that the source on the master branch is always working though, sometimes bad patches can get in before a release. For now, official releases are on Github (expand the Assets section under the changelog to see the downloadables) and also available via Docker, and Fedora/Centos/Redhat via COPR (see the install page in the docs)

1 Like

Great!

One last question - I have a log directive to send logging info to a file. That’s working, but I still get
log output sent to the console. Is there a way to disable that behavior?

-joe

@Joe_McGuckin You can just ignore the logs you don’t want, but enough users have asked for this that I opened up this PR that could go into 2.1 if we approve it: caddyhttp: General improvements to access logging by mholt · Pull Request #3301 · caddyserver/caddy · GitHub

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.