Caddy keeps crushing when many users are uploading images

1. Caddy version (caddy version):

v2.4.1

2. How I run Caddy:

a. System environment:

Ubuntu 20

b. Command:

sudo systemctl start caddy

c. Service/unit/compose file:

Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane.

d. My complete Caddyfile or JSON config:

k.sand-box.online {
    root * /var/www/k/public/
    encode gzip
    file_server
    php_fastcgi unix//run/php/php7.4-fpm.sock
    log {
       output file /var/log/caddy/k.log
       format console
    }
}

My php.ini config 

max_execution_time = 60
max_input_time = 60
max_input_vars = 3000
memory_limit = 512M
post_max_size = 150M
upload_max_filesize = 100M
max_file_uploads = 10
date.timezone = "Africa/Nairobi"

3. The problem I’m having:

Hi Caddy community,

I have a Laravel application that has a form for data input. The form has an upload images feature and it to only 5 uploads only per request and image size less than 4mb.

The issue is every time there are a number of users, >40, using the form I noticed the server becomes slow and freezes. I have to stop caddy sudo service caddy stop and start it again. If there are less users, <20, the caddy service works well.

The log error is too large and format I am not able to understand.

Is there a caddy config that can help me diagnose what may be the problem? Is there a config I may have missed out?

4. Error messages and/or full log output:

5. What I already tried:

6. Links to relevant resources:

Please include the logs. We can’t help you diagnose the issue without seeing what’s in the logs. Put the following at the top of your Caddyfile to enable verbose logging:

{
    debug
}

Run journalctl -u caddy --no-pager | less to copy the content without truncation.

1 Like

I had this same issue with my setup. The issue wasn’t with Caddy. I had the default PHP-FPM settings and after some research, I raised the max_children and it solved my issue.

1 Like

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