Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uploaded images not visible in emails and UI #291

Open
igisho opened this issue Aug 20, 2024 · 1 comment
Open

Uploaded images not visible in emails and UI #291

igisho opened this issue Aug 20, 2024 · 1 comment

Comments

@igisho
Copy link

igisho commented Aug 20, 2024

mautic version 5.1

my docker compose:

version: '3'

x-mautic-volumes:
  &mautic-volumes
  - ./mautic/config:/var/www/html/config:z
  - ./mautic/logs:/var/www/html/var/logs:z
  - ./mautic/media/files:/var/www/html/docroot/media/files:z
  - ./mautic/media/images:/var/www/html/docroot/media/images:z
  - ./cron:/opt/mautic/cron:z
  - mautic-docroot:/var/www/html/docroot:z

services:
  nginx:
    image: nginx
    volumes:
      - ./nginx.conf:/etc/nginx/conf.d/default.conf
      - mautic-docroot:/var/www/html/docroot:z
      - ./certbot/www/:/var/www/certbot/:ro
      - ./certbot/conf/:/etc/letsencrypt/:ro
    depends_on:
      - mautic_web
    ports:
      - 80:80
      - 443:443
    restart: always
    networks:
      - default

  certbot:
    image: certbot/certbot
    volumes:
      - ./credentials.ini:/.secrets/certbot/credentials.ini
      - ./certbot/www/:/var/www/certbot/:rw
      - ./certbot/conf/:/etc/letsencrypt/:rw
    networks:
      - default
    entrypoint: /bin/sh -c "pip install certbot-dns-cloudflare && certbot certonly --dns-cloudflare --dns-cloudflare-credentials /.secrets/certbot/credentials.ini -d '*.some.com'"

  mautic_web:
    image: mautic/mautic:5.1-fpm
    volumes: *mautic-volumes
    environment:
      - DOCKER_MAUTIC_LOAD_TEST_DATA=${DOCKER_MAUTIC_LOAD_TEST_DATA}
      - DOCKER_MAUTIC_RUN_MIGRATIONS=${DOCKER_MAUTIC_RUN_MIGRATIONS}
    env_file:
      - .mautic_env
    healthcheck:
      test: cgi-fcgi -bind -connect 127.0.0.1:9000
      start_period: 5s
      interval: 5s
      timeout: 5s
      retries: 100
    networks:
      - default

  mautic_cron:
    image: mautic/mautic:5.1-fpm
    volumes: *mautic-volumes
    environment:
      - DOCKER_MAUTIC_ROLE=mautic_cron
    env_file:
      - .mautic_env
    depends_on:
      mautic_web:
        condition: service_healthy
    networks:
      - default

  mautic_worker:
    image: mautic/mautic:5.1-fpm
    volumes: *mautic-volumes
    environment:
      - DOCKER_MAUTIC_ROLE=mautic_worker
    env_file:
      - .mautic_env
    depends_on:
      mautic_web:
        condition: service_healthy
    networks:
      - default

volumes:
  mautic-docroot:
  certbot:

networks:
  default:
    name: ${COMPOSE_PROJECT_NAME}-docker

my nginx:

server {
    listen 80;

    server_name *.some.com;

    location / {
        return 301 https://$host$request_uri;
    }
}

server {
    listen 443 ssl;
    server_name *.some.com;

    ssl_certificate /etc/letsencrypt/live/some.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/some.com/privkey.pem;

    root /var/www/html/docroot;

    location / {
        index index.php;
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_pass mautic_web:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
    }
}

Mautic is running normally, no problem with logs, but images in email are not shown. I can upload and they are uploaded with correct permissions to media/images but in system i can only see empty placeholder thumbnail.
image

tried all solutions i know about to fix it:
checked permissions/owners

Nginx log:

fpm-nginx-nginx-1 | 192.168.3.71 - - [20/Aug/2024:14:25:23 +0000] "GET /media/images/dae93048ab9e3691f5aee5369c6bbc22.jpg HTTP/1.1" 404 66728 "https://some.com/s/emails/new" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36" "-"

@igisho igisho changed the title Images not visible in emails Uploaded images not visible in emails and UI Aug 21, 2024
@riisi
Copy link

riisi commented Nov 7, 2024

I had the same issue and was able to resolve by setting the nginx user to www-data (to match the file permissions set in the entrypoint scripts).

Note this needed to be set in the main nginx.conf file at /etc/nginx/nginx.conf - I changed the volume mapping from the example docker-compose file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants