Mautic 5.0.4 images return 404

My Mautic version is: 5.0.4
My PHP version is: 8.1.28
My Database type and version is: 10.11.2-MariaDB-1

Your problem
My problem is:

When I issue a request for an image file (.i.e.: /media/images/phpondocker.png) mautic replies with 404.

Steps I have tried to fix the problem:

I tried to follow the steps in Mautic 4.4.4 images are not displayed in landing page and email but I can’t find the issue.

I recently installed Mautic 5.0.4 using a php-fpm docker image, the db is in another server. I migrated everything from my previous 4.4.4 installation and it all works ok… just the images stored within mautic fail.


So apparently I solved my problem by mounting the images directory on the nginx.

I found that, while the images were correctly stored on my server, when trying to access them from within docker (docker compose exec nginx ls /var/www/html/docroot/media/images -l) I was getting nothing. That’s what made me suspicious.

When I add these lines to my docker-compose.yml file:

      - ./mautic/media/files:/var/www/html/docroot/media/files:z
      - ./mautic/media/images:/var/www/html/docroot/media/images:z

It all started working. I probably didn’t need the mapping for the files directory at the moment but I figured it could be usefull in the future.