Running magento 2.4.4 w/ Nginx and varnish. Everything works well except images on my shopping cart are not showing!

I set the permissions of my files correctly. When I check my source it says this:

When I check my server the images are there at the location


There is an extra /pub as you can see.

my Nginx relevant config is this

location /pub/ {
    location ~ ^/pub/media/(downloadable|customer|import|custom_options|theme_customization/.*\.xml) {
        deny all;
    alias $MAGE_ROOT/pub/;
    add_header X-Frame-Options "SAMEORIGIN";

location /media/ {

   try_files $uri $uri/ /get.php$is_args$args;

    location ~ ^/media/theme_customization/.*\.xml {
        deny all;

    location ~* \.(ico|jpg|jpeg|png|gif|svg|svgz|webp|avif|avifs|js|css|eot|ttf|otf|woff|woff2)$ {
        add_header Cache-Control "public";
        add_header X-Frame-Options "SAMEORIGIN";
        expires +1y;
        try_files $uri $uri/ /get.php$is_args$args;

logs shows nothing.

This is driving me nuts. Beside permission and nginx conf. what else could this be?

1 Answer 1


check your app/etc/env.php file.

'directories' => [
    'document_root_is_pub' => true

I use nginx too. And my document root is the pub directory. In my case, i had to set document_root_is_pub to true, to tell magento, that pub is the document root. check nginx.conf.sample Line 32

root $MAGE_ROOT/pub;
  • This was exactly my issue. I actually found it prior to your answer since my nginx config was changed after an update of magento. Thank you!
    – Henri
    May 11, 2022 at 12:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.