1. Output of caddy version
:
v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=
2. How I run Caddy:
a. System environment:
Debian Sid, Caddy installed from official repo
c. Service/unit/compose file:
# caddy.service
#
# For using Caddy with a config file.
#
# Make sure the ExecStart and ExecReload commands are correct
# for your installation.
#
# See https://caddyserver.com/docs/install for instructions.
#
# WARNING: This service does not use the --resume flag, so if you
# use the API to make changes, they will be overwritten by the
# Caddyfile next time the service is restarted. If you intend to
# use Caddy's API to configure it, add the --resume flag to the
# `caddy run` command or use the caddy-api.service file instead.
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target
[Service]
Type=notify
User=www-data
Group=www-data
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile --force
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateDevices=yes
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
d. My complete Caddy config:
{
storage file_system /var/www/caddy
on_demand_tls {
interval 2m
burst 5
}
}
https:// {
tls {
on_demand
}
root * /var/www/{host}/htdocs/
php_fastcgi unix//run/php/php8.2-fpm.sock
php_fastcgi /wp-admin/* unix//run/php/php-admin.sock
file_server {
precompressed br
}
encode gzip
header /* {
-Server
}
@cache {
not header_regexp Cookie "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in"
not path_regexp "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(index)?.xml|[a-z0-9-]+-sitemap([0-9]+)?.xml)"
not method POST
not expression {query} != ''
}
route @cache {
try_files /wp-content/cache/cache-enabler/{host}{uri}/https-index.html /wp-content/cache/cache-enabler/{host}{uri}/index.html {path} {path}/index.php?{query}
}
@disallowed {
path /xmlrpc.php
path /wp/xmlrpc.php
path *.sql
path /wp-content/uploads/*.php
}
rewrite @disallowed '/index.php'
}
3. The problem I’m having:
I am trying to use two php-fpm pools for my sites. One for the front-end and another for Wordpress Admin Area. I have added two fastcgi config in the Caddyfile to achieve the same. But it’s not working. The default pool values are still being used all across. I am trying to achieve what this article did but for the whole wp-admin area and not just for update url. Selective Elevation of PHP in Nginx+WordPress » KBeezie
I am not sure if my config is right for php_fastcgi for the admin area. I’ll appreciate some help. Thank you for the amazing work the whole team is doing on Caddy!