DokuWiki

It's better when it's simple

User Tools

Site Tools


install:caddy

Caddy

DokuWiki with caddy (version 2)

You need to install caddy and php-fpm, if you are on a current release, this will be at least php7.0.

On the initial setup you won't be able to start unless you comment the forbidden block to the install.php file.

This is the full configuration we use you can simply copy paste and change the names to your liking. This configuration is for Nice URLs rewriting. See URL Rewriting.

https://your.wikidomain.com {

    encode gzip zstd
    root * /srv/doku

    #Remember to comment the below forbidden block out when you're installing, and uncomment it when done.
    @forbidden path /data/* /conf/* /bin/* /inc/* /install.php
    handle @forbidden {
        respond * 403
    }
    #End of the forbidden block
 
    try_files {path} {path}/index.html

    route {
        handle_path /_media/* {
            rewrite * /lib/exe/fetch.php?media={path}&{query}    
        }
        handle_path /_detail/* {
            rewrite * /lib/exe/detail.php?media={path}&{query}
        }        
        handle /_export/* {
            @export path_regexp export ^/_export/([^/]+)/(.*)
            rewrite @export /doku.php?do=export_{re.export.1}&{query}&id={re.export.2}
        }
        handle / {
            rewrite * /doku.php?{query}
        }
        try_files {path} /doku.php?id={path}&{query}
    }

    file_server
    php_fastcgi 127.0.0.1:9000
}

If you get a 502 gateway issue, it usually means there is a problem with your phpfpm socket configuration (usually wrong path to the socket). Please see the docs for phpfpm and caddy.

install/caddy.txt · Last modified: 2021-03-24 04:25 by boypt

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki