Running Foswiki with Caddy

  • Tip Category - Installation and Upgrading
  • Tip Added By - SamMorris - 20 Nov 2017 - 12:42
  • Extensions Used - FastCGIEngineContrib
  • Useful To - Beginners
  • Tip Status - New
  • Related Topics -
Here's how I got Foswiki working behind the Caddy web server.


The only thing in caddy's web root is a symlink for the /pub directory, which leads to the pub directory in my Foswiki directory. This way I don't have to worry about blocking access to Foswiki's data directory, code, etc., via the web server.

$ ls -l /caddy/www
lrwxrwxrwx 1 root root 22 Nov 20 12:22 pub -> ../../foswiki/wiki/pub

Caddy is configured as follows:

$ cat /caddy/Caddyfile
:443 {
    log stdout
    tls self_signed

    # Deal with the "front page" redirect
    redir 302 {
        if {path} is /
        / /Main/WebHome

    # Shorter URLs
    rewrite {
        regexp ^(/[A-Z].*)
        to /bin/view/{1}

    # Communicate with Foswiki
    fastcgi /bin /foswiki/socket {
        split /bin


I find it simpler to launch Foswiki directly via systemd, rather than with the bundled init script. I do so with a simple cd /foswiki/wiki/bin && ./foswiki.fcgi --listen=/foswiki/socket.

BestPracticeTipsForm edit

Category Installation and Upgrading
Related Topics
Topic revision: r1 - 20 Nov 2017, SamMorris - This page was cached on 22 May 2019 - 18:15.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy