mautic / docker-mautic

Docker Image for Mautic
https://www.mautic.org
374 stars 278 forks source link

Assets throwing 404 in installer #297

Open mcnaveen opened 3 weeks ago

mcnaveen commented 3 weeks ago

I set up Mautic with docker and nginx (host) and the installer seems to be broken, Because the assets are throwing 404.

2r57ySFmAC60FOpZlk70SaE0k7aVVQwT

Here is my nginx config

server {
    listen 80;
    listen [::]:80;
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    server_name mydomain.com;

    # Redirect www to non-www
    if ($host = www.mydomain.com) {
        return 301 https://mydomain.com$request_uri;
    }

    # Redirect HTTP to HTTPS
    if ($scheme = http) {
       return 301 https://$server_name$request_uri;
    }

    access_log  /var/log/nginx/mautic-access.log;
    error_log   /var/log/nginx/mautic-error.log;

    root /var/www/html/docroot;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }

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

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
     expires max;
    log_not_found off;
    }

    client_max_body_size 70m;

    ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
    add_header Strict-Transport-Security max-age=63072000;
    add_header X-XSS-Protection "1; mode=block";
}

My docker-compose.yml

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:
  db:
    image: mysql:8.0
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - MYSQL_DATABASE=${MYSQL_DATABASE}
      - MYSQL_USER=${MYSQL_USER}
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
    volumes:
      - mysql-data:/var/lib/mysql
    healthcheck:
      test: mysqladmin --user=$$MYSQL_USER --password=$$MYSQL_PASSWORD ping
      start_period: 5s
      interval: 5s
      timeout: 5s
      retries: 10
    networks:
      - default

  mautic_web:
    image: mautic/mautic:5-fpm
    links:
      - db:mysql
    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
    depends_on:
      db:
        condition: service_healthy
    networks:
      - default
    ports:
      - "62175:9000"

  mautic_cron:
    image: mautic/mautic:5-fpm
    links:
      - db:mysql
    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-fpm
    links:
      - db:mysql
    volumes: *mautic-volumes
    environment:
      - DOCKER_MAUTIC_ROLE=mautic_worker
    env_file:
      - .mautic_env
    depends_on:
      mautic_web:
        condition: service_healthy
    networks:
      - default

volumes:
  mysql-data:
  mautic-docroot:
networks:
  default:
    name: ${COMPOSE_PROJECT_NAME}-docker