New Caddy User with Wordpress errors

1. Caddy version (caddy version):

v2.4.3 h1:Y1FaV2N4WO3rBqxSYA8UZsZTQdN+PwcoOcAiZTM8C0I=

2. How I run Caddy:

installed as systemd with
php 7.3 including php7.3-fpm php7.3-mbstring php7.3-mysql php7.3-curl php7.3-gd php7.3-curl php7.3-zip php7.3-xml installed.
mariadb 10.3.9

a. System environment:

Raspberry Pi 4
OS Raspbian 10 (Buster)

b. Command:

run via systemd

Paste command here.

c. Service/unit/compose file:


ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile


d. My complete Caddyfile or JSON config:

localhost:80 {
encode zstd gzip
root * /var/www/localhost
file_server browse
} {
encode zstd gzip
root * /var/www/
php_fastcgi unix//run/php/php7.3-fpm.sock
@wp-admin {
  path not ^/wp-admin/*
rewrite @wp-admin {path}/index.php?{query}
file_server browse

3. The problem I’m having:

I am getting the dreaded 500 server error on several of the wp-admin pages.
The main site seems to be ok and login does work however display of Dashboard pages produces the error. some however do not - for instance I can access the site setting page, the menus page and even add users just not the main dashboard.

I don’t think it is a caddy error as that setup seems to have gone ok and have also had reverse proxy for non wordpress site and a sub-domain working prior to installing wordpress however I am struggling to determine where the issue lies i.e. wordpress, caddy, php or other - I cannot seem to find any logs that produce any details.

Any advice to a complete newbie on how to pinpoint the area to focus on would be appreciated.

4. Error messages and/or full log output:

Cannot get any log messages at all - that is half the problem as I cannot pin point the actual part of the system that is an error.

5. What I already tried:

Numerous versions of caddy file including

  • simple index.php rather than wordpress and sucessfully displays php version info.

  • php_fastcgi (also changed php.ini to match)

no themes or plugins in wordpress
Debug is turned on in wordpress - no output.
ufw disabled

6. Links to relevant resources:

Numerous forums and online articles for php, wordpress and caddy

Check file permissions in /var/www/, make sure both the caddy user (which the systemd service runs as) and the php-fpm user can both read the files at that location.

Not much else I can point to without logs.

Hi - thanks for quick response …

files in the /var/www/ are owned by caddy and have 555 permissions. php-fpm is configured to use caddy user as well. So I think they should be good.

getting logs seems to be my may issue at the moment - I’ve tried to get logs for php and caddy but without success

I thought I had php logging turned on and should be writing to a log file but is empty.
and tried adding

log {
	output file /var/log/caddy_1.log

but no logs generated. Obviously missing something fundamental on the log setup.

Since you’re running Caddy as a service, you should run journalctl -u caddy --no-pager | less to find your logs. Caddy emits to stdout/stderr which ends up in the journal.

Hi - ok great - that has got me going a bit further. Many thanks for the pointer.
It looks like it is a wordpress issue (see log below) I will do some research on this error

Jul 12 16:44:42 web1 caddy[1496]: {"level":"error","ts":1626104682.5060937,"logger":"http.log.error.lo
g0","msg":"template: /wp-admin/index.php:465: function \"data\" not defined","request":{"remote_addr":
ent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.44
72.124 Safari/537.36 Edg/91.0.864.67"],"Sec-Ch-Ua":["\" Not;A Brand\";v=\"99\", \"Microsoft Edge\";v=\
"91\", \"Chromium\";v=\"91\""],"Sec-Ch-Ua-Mobile":["?0"],"Referer":[""],"Accept-En
coding":["gzip, deflate, br"],"Cookie":["wordpress_sec_c7805485dfbc56411683e5ae2d88430b=tmb40%7C162627
8f3520ff22c6cc2; wordpress_test_cookie=WP+Cookie+check; wordpress_logged_in_c7805485dfbc56411683e5ae2d
c3228f0f3b24c4c371153e3b62fa8da8c22d; wp-settings-time-1=1626101004"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Sec-Fetch-Site":["same-origin"],"Sec-Fetch-User":["?1"],"Sec-Fetch-Dest":["document"],"Accept-Language":["en-GB,en;q=0.9,en-US;q=0.8"]},"tls":{"resumed":false,"version":772,"cipher_suite":4867,"proto":"http/1.1","proto_mutual":true,"server_name":""}},"duration":0.14822989,"status":500,"err

Thanks for assistance so far.

As my first look into Caddy and the set up so far it has worked really well and responsive forum adds to that experience even when my question was very general.


This topic was automatically closed after 30 days. New replies are no longer allowed.