Skip to content

Caddy web server config

Robert Isoski edited this page May 22, 2022 · 3 revisions

Add your hostname and web root to the Caddy configuration. Replace the example.com with your actual domain and the root path with your actual path where WonderCMS is installed.

example.com {
    root * /var/www/wondercms
    file_server

    respond /cache.json 403
    respond /database.js 403

    try_files {path} {path}/ /index.php?page={http.request.orig_uri.path.file}&{query}

    php_fastcgi unix//var/run/php/php7.4-fpm.sock
}

The code above replicates Apache's htaccess functionality with the power of your Caddy server config. Since Caddy doesn't have the "traditional" htaccess file, this is necessary to make WonderCMS work properly.


NOTE: The code above is required to deny access to database.js, cache.json and make clean URL's which are SEO friendly.


Thanks to Prophet-Phoenix and francislavoie.

Clone this wiki locally