Lint the Caddy configuration


(Bob Brown) #1

Hi all,

We’re well on our way to dropping apache across the board and using Caddy with PHP-FPM. One of the useful things in Apache is the ability to lint the config before restarting the server, e.g. apache2ctl configtest.

Is there a similar tool for Caddy? I have had a search but nothing is coming up.

Cheers,

  • Bob -

(Matthew Fay) #2

I was going to suggest caddy -validate, which purportedly checks that the Caddyfile is valid and then exits…

https://caddyserver.com/docs/cli#validate

However, it actually just starts the Caddy server on my mac (version 0.11.0). That probably shouldn’t be the case, right @matt?


(Matt Holt) #3

Works for me:

Are you sure? :-/


(Matthew Fay) #4

Fairly sure.

41%20pm


(Matt Holt) #5

Dumb question, but do you have a Caddyfile in that folder?


(Matthew Fay) #6

No. Here’s what happens when I run caddy -validate in a folder with a Caddyfile:

35%20am


(Matt Holt) #7

… that’s really weird. I can’t explain it :man_shrugging:


(Matthew Fay) #8

I just re-downloaded 0.11.0 with no plugins, seems to be validating instead of starting now. Seems to imply one of the plugins I was using was interfering.