4

Caddy seems to be an easy to use alternative to established web servers. How does the Caddyfile look like for a Craft site?

4

For local development the Caddyfile looks like this (assuming that php-fpm runs on port 9000, you may have to adapt root to point to your web root relative to the location of the Caddyfile):

localhost:2020 {
    root public_html
    fastcgi / 127.0.0.1:9000 php
    rewrite {
        r .*
        to {uri} {uri}/ /index.php?p={uri}&{query} /index.php?{query}
    }
}

Edit: For Caddy >= 0.9.x the rewrite has to be changed to this:

rewrite {
  to {path} {path}/ /index.php?p={path}&{query} /index.php?{query}
}
| improve this answer | |
  • Have you noticed any issues with running tasks with Caddy server? I've noticed that even P&T's own PowerNap task example doesn't run properly on Caddy. – Chase Giunta Jul 25 '16 at 2:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.