Example: Wordpress multisite

Spent a day or two getting Wordpress multisite working and hope I can save you the trouble. This thread points in the right direction, but the solution pushed and selected ( uri path_regexp (\/{1})(\w|\d|\s)+\/wp- /wp-) doesn’t work as the regexp strips whatever is in front of “/wp-” multiple times (e.g. user/wp-admin/wp-content/js/wp-js.min.js will become user/wp-admin/wp-content/wp-js.min.js).

Assuming Wordpress, PHP-FPM and Caddy is installed, a working Caddyfile:

{
    email admin@example.com
}

example.com {
    root * /srv/wordpress

    uri path_regexp ^/[a-zA-Z0-9]+/wp- /wp-
    php_fastcgi unix//run/php/php8.3-fpm.sock
    file_server
}

Working regexp was provided by @francislavoie here, in the same thread that selects a non-working solution.

A post was merged into an existing topic: Caddyfile Wordpress Multisite

I moved your post into the original topic :+1:

2 Likes