On this page
- What do you need to run Mautic?
- How do you write the environment and compose files?
- How do you start the containers and verify them?
- How do you publish Mautic with HTTPS?
- How do you complete the Mautic installer?
- How do you configure sending through a relay?
- Which scheduled jobs does Mautic need?
- How do you back up, upgrade and troubleshoot Mautic?
- Questions
What do you need to run Mautic?
Mautic is a PHP and Symfony application with a MySQL or MariaDB database, a message queue worker for sending, and scheduled console commands that rebuild segments and move contacts through campaigns. Give it 2 vCPU and 4 GB of memory; large segment rebuilds are the heaviest task.
- Docker and Compose, via Docker Engine or the Docker app image.
- A hostname like
mautic.example.netpointing to198.51.100.24and2001:db8:4f2a::24. - An SMTP relay or sending service account; marketing mail volume makes a relay essential.
Mautic publishes image tags by major version and flavour, such as 6-apache. Check Docker Hub for the newest major tag before you begin and use it everywhere below.
How do you write the environment and compose files?
Keep secrets in .env and share one set of volumes between the web and worker roles.
mkdir -p ~/mautic && cd ~/mautic
mkdir -p data/config data/logs data/media/files data/media/images
nano .envMYSQL_ROOT_PASSWORD=root-random-value
MYSQL_DATABASE=mautic
MYSQL_USER=mautic
MYSQL_PASSWORD=db-random-valueThen create compose.yaml:
x-mautic: &mautic
image: mautic/mautic:6-apache
restart: always
env_file: .env
depends_on:
- db
volumes:
- ./data/config:/var/www/html/config
- ./data/logs:/var/www/html/var/logs
- ./data/media/files:/var/www/html/docroot/media/files
- ./data/media/images:/var/www/html/docroot/media/images
services:
db:
image: mariadb:11.4
restart: always
env_file: .env
volumes:
- mautic-db:/var/lib/mysql
web:
<<: *mautic
ports:
- "127.0.0.1:8080:80"
environment:
DOCKER_MAUTIC_ROLE: mautic_web
MAUTIC_DB_HOST: db
MAUTIC_DB_PORT: 3306
MAUTIC_DB_DATABASE: mautic
MAUTIC_DB_USER: mautic
MAUTIC_DB_PASSWORD: db-random-value
MAUTIC_TRUSTED_PROXIES: '["0.0.0.0/0"]'
worker:
<<: *mautic
environment:
DOCKER_MAUTIC_ROLE: mautic_worker
MAUTIC_DB_HOST: db
MAUTIC_DB_PORT: 3306
MAUTIC_DB_DATABASE: mautic
MAUTIC_DB_USER: mautic
MAUTIC_DB_PASSWORD: db-random-value
volumes:
mautic-db:The trusted proxies setting lets Mautic believe the HTTPS scheme that Nginx reports. The official docker-mautic repository has fuller examples, including a dedicated cron role, if you prefer to follow those.
How do you start the containers and verify them?
Start the database first, then the application roles, and look at the web log.
cd ~/mautic
docker compose up -d db
sleep 15
docker compose up -d
docker compose ps
docker compose logs --tail 30 web
curl -sI http://127.0.0.1:8080 | head -n 1A redirect toward the installer means the web role is ready. The image prints the Mautic version in its log; later docker compose exec web php bin/console --version reports it too.
How do you publish Mautic with HTTPS?
Terminate TLS in Nginx and forward to port 8080 with the usual forwarded headers. Tracking pixels and forms are loaded from other websites, so HTTPS is required for them to work on secure pages.
sudo apt install -y nginx certbot python3-certbot-nginx
sudo tee /etc/nginx/sites-available/mautic >/dev/null <<'EOF'
server {
listen 80;
listen [::]:80;
server_name mautic.example.net;
client_max_body_size 64M;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 300s;
}
}
EOF
sudo ln -s /etc/nginx/sites-available/mautic /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d mautic.example.net
sudo ufw allow OpenSSH && sudo ufw allow 'Nginx Full' && sudo ufw enableCaddy fits here too with reverse_proxy 127.0.0.1:8080 (Caddy HTTPS).
How do you complete the Mautic installer?
Go to https://mautic.example.net: the installer checks the environment, then asks for database details (host db, port 3306, database mautic, user mautic and its password), then for the admin user. Finish, sign in, and open Settings, Configuration, System Settings to confirm the Site URL is the HTTPS address. Its config is written to data/config on the host, so it survives container upgrades.
How do you configure sending through a relay?
Under Settings, Configuration, Email Settings, set the transport DSN to your relay with port 587, for example scheme smtp, host smtp.relay.example.net, port 587, user and password, and fill in the From name and address. Send a test email from the same screen. Marketing mail depends on reputation, so use a relay or sending service that permits bulk mail, publish SPF, DKIM and DMARC records (SPF, DKIM and DMARC), and include unsubscribe links. Port 25 is not promised for direct delivery; ask support by ticket before planning your own outgoing mail server, and see SMTP relay for apps.
Which scheduled jobs does Mautic need?
Segments, campaigns and scheduled broadcasts only advance when their console commands run. Add them to the host crontab of your sudo user, calling into the web container:
crontab -e*/10 * * * * cd ~/mautic && docker compose exec -T web php bin/console mautic:segments:update --batch-limit=900 >/dev/null 2>&1
*/10 * * * * cd ~/mautic && docker compose exec -T web php bin/console mautic:campaigns:update >/dev/null 2>&1
*/5 * * * * cd ~/mautic && docker compose exec -T web php bin/console mautic:campaigns:trigger >/dev/null 2>&1
*/15 * * * * cd ~/mautic && docker compose exec -T web php bin/console mautic:broadcasts:send >/dev/null 2>&1
0 3 * * * cd ~/mautic && docker compose exec -T web php bin/console mautic:import >/dev/null 2>&1Stagger the minutes if several jobs collide on a small server. The worker container consumes the email queue, so messages leave without a cron entry of their own. Timing syntax is explained in the cron guide.
How do you back up, upgrade and troubleshoot Mautic?
cd ~/mautic
docker compose exec -T db sh -c 'mariadb-dump -u root -p"$MYSQL_ROOT_PASSWORD" mautic' | gzip > mautic-$(date +%F).sql.gz
tar czf mautic-data-$(date +%F).tgz data .envFor upgrades, change the tag in compose.yaml only after reading the release notes, then docker compose pull && docker compose up -d; the web role applies migrations at start. Common issues:
- Mixed content or http links: the trusted proxies setting or the Site URL is wrong.
- Contacts never enter a campaign: the segment and campaign cron jobs are not running; run one by hand and read its output.
- Emails stay queued: inspect
docker compose logs worker. - Memory exhaustion during segment builds: lower
--batch-limitor move to a larger plan.
Plans that fit this guide
Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.
Questions about Mautic marketing automation
Is Mautic free to self-host?
Yes. Mautic is open source under the GPLv3 license, with no limit on contacts in the self-hosted version.
Can I install Mautic without Docker?
Yes. Mautic documents a Composer-based install on a PHP web server; check that your distribution PHP version matches the Mautic release you choose.
Why do I need a relay for marketing email?
Bulk mail needs a sending reputation and feedback handling that a fresh server IP lacks, and port 25 is not guaranteed to be open. A relay on port 587 handles delivery.
How do I track visitors on my website?
Paste the tracking script from Settings, Tracking Settings into your site. Visits are then linked to known contacts after they fill a Mautic form.
Can Mautic and my CRM share contacts?
Mautic includes plugins for several CRMs and a REST API for custom syncs, for example with Odoo.
More in Self-hosted apps
- Nextcloud on Nginx
- ownCloud Infinite Scale
- Seafile file sync
- Vaultwarden password vault
- Passbolt team password manager
- Gitea Git hosting
- Forgejo Git server
- GitLab Community Edition
- Gogs Git service
- Wiki.js
- BookStack documentation
- Outline knowledge base
- Paperless-ngx documents
- n8n workflow automation
- Activepieces automation
- Plausible Analytics (Community Edition)
- Umami analytics
- Mattermost team chat
- Matrix Synapse with Element
- Jitsi Meet video calls
- ONLYOFFICE Docs with Nextcloud
- HashiCorp Vault secrets server
- OpenBao secrets management
- Infisical secrets manager
- Authelia SSO and forward auth
- Zitadel identity platform
- VS Code in the browser (code-server)
- Joplin Server for notes sync
- Firefly III personal finance
- Snipe-IT asset tracking
- Odoo ERP on Ubuntu or Debian
- ERPNext with frappe_docker
- Dolibarr ERP and CRM with Nginx
- Penpot design tool with Docker
- Planka kanban boards
- Leantime project management
- Wekan boards with Docker
- Cal.com scheduling
- Chatwoot support inbox
- DocuSeal document signing
- Metabase dashboards
- Appwrite backend server
- Self-hosted Supabase
- PocketBase backend
- RustDesk relay server
- Traccar GPS tracking
- Redmine project tracker
- The Lounge IRC client
- CyberChef data toolbox
- Typebot chat forms
- AFFiNE workspace
- Overleaf Community Edition
- Neko shared virtual browser
- imgproxy image resizing
- NetBox network inventory
- UVdesk help desk
- YetiForce CRM