Troubleshooting Guide for Caddyserver with fastcgi

I am using Caddyserver on a Ubuntu 16.04 server and I have 3 wordpress sites running under cgi. Everything seems to work except that random users tell me that there is a connection delay and sometimes in the middle of their visit, they get random disconnects. I have been able to verify each instance and it appears to be on the Caddyserver side. I have cloned the server and run it for a few weeks with Nginx and no problems. My question is to find out if there is a troubleshooting guide or recommendations on how to trouble shoot or track what is going on with Caddyserver.


I’ve heard of this before but we’ve never been able to reproduce it, I think. /cc @abiosoft

What is your full and exact Caddyfile? What version of Caddy are you running?

I’m running version 0.9.5.

Caddyfile:, { root /var/www/ gzip fastcgi / php rewrite { if {path} not_match ^\/wp-admin to {path} {path}/ /index.php?_url={uri} } log stdout errors stdout } site1.moc, www.site1.moc { root /var/www/site1.moc gzip fastcgi / php rewrite { if {path} not_match ^\/wp-admin to {path} {path}/ /index.php?_url={uri} } log stdout errors stdout } site2.moc, www.site2.moc { root /var/www/site2-moc gzip fastcgi / php rewrite { if {path} not_match ^\/wp-admin to {path} {path}/ /index.php?_url={uri} } log stdout errors stdout }

This is what people see when they click on one of the sites and it’s acting up

What if you add timeouts none to each of your sites in the Caddyfile?

Hi Matt,

I added the timeouts last night. Been testing it, and still get the same issue. The only error in the syslog is this:

http2: server: error reading preface from client read tcp> read: connection reset by peer

Please advise.

Connection reset by peer isn’t of concern, sounds like a client just disconnected of its own choice.

I wonder if this is related to If so, it’s been impossible to reproduce reliably so far.

It might be. I rolled back to 0.9.1 and it did seem like 2/3 sites were flying. One thing I have noticed is that it seems to happen every time I do something silly like type (wordpress will redirect to ( I can do the reverse) and have wordpress redirect to and the delays begin. Once the pages are cached, the problem isn’t a problem (of course) It’s that initial hit that just sits there. Also, it takes about 3-5 minutes after launching caddy before you see the issue. For the first couple of minutes, everything flies.

Is this before or after you roll back?

Before. Using version 0.9.5.

So after rolling back it works fine?

Correct. The version 0.9.1 works.

Does anyone know how to troubleshoot Caddyserver? I would really like to dig in and figure out why this isn’t working. Any update @matt ? Thanks.

Given the likelihood that this is an problem with Caddy, the best place to get some movement would be to file a github issue at

@maro I notice you are using the same fastcgi instance for all your servers/hosts.

Could you try creating a seperate instance (eg port) for each host and see if your issue still occurs?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.