Created
May 21, 2020 16:22
-
-
Save ryanburnette/89ea0796710d36315f8b3f52d6f3e87f to your computer and use it in GitHub Desktop.
nested WordPress instances with Caddy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[hostname] { | |
encode gzip | |
log { | |
output file /var/log/caddylog | |
} | |
@canonicalPath { | |
file { | |
try_files {path}/index.php | |
} | |
not path */ | |
} | |
@altsite1 { | |
file { | |
try_files {path} {path}/index.php /altsite1{path} /altsite1/index.php | |
split_path .php | |
} | |
path /altsite1/* | |
} | |
@altsite2 { | |
file { | |
try_files {path} {path}/index.php /altsite2{path} /altsite2/index.php | |
split_path .php | |
} | |
path /altsite2/* | |
} | |
@rootsite { | |
file { | |
try_files {path} {path}/index.php index.php | |
split_path .php | |
} | |
not path /altsite1/* | |
not path /altsite2/* | |
} | |
@phpFiles { | |
path *.php | |
} | |
route { | |
redir @canonicalPath {path}/ 308 | |
rewrite @altsite1 {http.matchers.file.relative} | |
rewrite @altsite2 {http.matchers.file.relative} | |
rewrite @rootsite {http.matchers.file.relative} | |
reverse_proxy @phpFiles unix//var/run/php/php-fpm.sock { | |
transport fastcgi { | |
split .php | |
} | |
} | |
} | |
root * /srv/wordpress/ | |
file_server | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You'll have to explain this to me.
Caddyfile supports comments, does't it?