DEV Community

Cover image for Deploying Mautic – An Open-Source Marketing Automation Platform
Sanskriti Harmukh for Vultr

Posted on with Aashish Chaurasiya • Originally published at docs.vultr.com

Deploying Mautic – An Open-Source Marketing Automation Platform

Mautic is an open-source marketing automation platform for email campaigns, contact tracking, lead nurturing, and analytics, a self-hosted alternative to HubSpot or Marketo with full control over your data. This guide installs Mautic on Ubuntu 24.04 with a LEMP stack (Nginx, MySQL, PHP), sets up cron jobs for background processing, and walks through campaigns, segments, forms, and landing pages.

Prerequisites: Ubuntu 24.04 instance, non-root sudo user, domain A record pointing at the instance (e.g. mautic.example.com).


Install the LEMP Stack

1. Install Nginx, MySQL, and PHP first (see a standard LEMP guide), then verify each:

$ nginx -v
$ mysql --version
$ php -v
Enter fullscreen mode Exit fullscreen mode

2. Install PHP extensions Mautic needs:

$ sudo apt install php-fpm php-mysql php-imap php-curl php-json php-gd php-xml php-mbstring php-zip php-intl php-bcmath php-opcache php-cli unzip -y
Enter fullscreen mode Exit fullscreen mode

3. Remove Apache if it was pulled in as a dependency (conflicts with Nginx):

$ sudo apt remove apache2 -y
Enter fullscreen mode Exit fullscreen mode

4. Tune PHP-FPM. Edit /etc/php/8.3/fpm/php.ini (replace 8.3 with your version):

$ sudo nano /etc/php/8.3/fpm/php.ini
Enter fullscreen mode Exit fullscreen mode
memory_limit = 512M
upload_max_filesize = 50M
post_max_size = 50M
date.timezone = UTC
cgi.fix_pathinfo=0
Enter fullscreen mode Exit fullscreen mode

5. Restart PHP-FPM:

$ sudo systemctl restart php8.3-fpm
Enter fullscreen mode Exit fullscreen mode

Create the Database

$ mysql -u root -p
Enter fullscreen mode Exit fullscreen mode
mysql> CREATE DATABASE mauticdb;
mysql> CREATE USER 'mauticuser'@'localhost' IDENTIFIED BY 'securepassword';
mysql> GRANT ALL PRIVILEGES ON mauticdb.* TO 'mauticuser'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> EXIT;
Enter fullscreen mode Exit fullscreen mode

Install Mautic

1. Download and extract the latest release:

$ wget https://github.com/mautic/mautic/archive/refs/tags/6.0.0.zip
$ unzip 6.0.0.zip
$ sudo mv mautic-6.0.0 /var/www/html/mautic
Enter fullscreen mode Exit fullscreen mode

2. Fix ownership:

$ sudo chown -R www-data:www-data /var/www/html/mautic
$ sudo chown www-data:www-data /var/www
Enter fullscreen mode Exit fullscreen mode

3. Install Composer and npm, then verify:

$ sudo apt install composer npm -y
$ composer --version
$ npm --version
Enter fullscreen mode Exit fullscreen mode

4. Install dependencies and set permissions:

$ cd /var/www/html/mautic
$ sudo -u www-data composer install
$ sudo chmod -R 755 /var/www/html/mautic
Enter fullscreen mode Exit fullscreen mode

Configure Nginx, TLS, and Cron

1. Create the vhost:

$ sudo nano /etc/nginx/conf.d/mautic.conf
Enter fullscreen mode Exit fullscreen mode
server {
    listen 80;
    server_name mautic.example.com;
    root /var/www/html/mautic;
    index index.php;
    access_log /var/log/nginx/example.com.access.log;
    error_log /var/log/nginx/example.com.error.log;

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

    location ~ .php$ {
         include snippets/fastcgi-php.conf;
         fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
         include fastcgi_params;
    }

    location ~ \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2)$ {
        expires 1y;
        access_log off;
        add_header Cache-Control "public";
    }
}
Enter fullscreen mode Exit fullscreen mode

2. Test and reload:

$ sudo nginx -t
$ sudo systemctl reload nginx
Enter fullscreen mode Exit fullscreen mode

3. Open the firewall and issue a certificate:

$ sudo ufw allow 80/tcp
$ sudo ufw allow 443/tcp
$ sudo ufw reload
$ sudo snap install certbot --classic
$ sudo certbot --nginx --redirect -d mautic.example.com -m hello@example.com --agree-tos
Enter fullscreen mode Exit fullscreen mode

Verify renewal works:

$ sudo certbot renew --dry-run
Enter fullscreen mode Exit fullscreen mode

4. Add cron jobs for background processing — segments, campaigns, email queue, imports, bounce fetch:

$ sudo -u www-data crontab -e
Enter fullscreen mode Exit fullscreen mode
* * * * * php8.3 /var/www/html/mautic/bin/console mautic:segments:update  > /dev/null
5-59/15 * * * * php8.3 /var/www/html/mautic/bin/console mautic:campaigns:update  > /dev/null
10-59/15 * * * * php8.3 /var/www/html/mautic/bin/console mautic:campaigns:trigger  > /dev/null
2-59/15 * * * * php8.3 /var/www/html/mautic/bin/console mautic:emails:send  > /dev/null
* * * * * php8.3 /var/www/html/mautic/bin/console mautic:import  > /dev/null
@hourly php8.3 /var/www/html/mautic/bin/console mautic:email:fetch
Enter fullscreen mode Exit fullscreen mode

Run the Web Installer

Visit https://mautic.example.com. You'll land on Ready to install. Click through:

  1. Database Setup — driver MySQL PDO, host localhost, the database/user/password created earlier.
  2. Admin user — username, password, recovery email.
  3. Log in with the admin credentials you just set.

Core Features

The dashboard is your hub for contacts, emails, campaigns, forms, and more.

  • Stages — track a contact's position in the funnel; assign via behavior, campaigns, or external events.
  • Companies — group contacts under a business entity for B2B segmentation/reporting.
  • Contacts — capture leads with tags, company links, owners, and stage assignment.
  • Segments — dynamic, auto-updating filtered groups used for campaign targeting.
  • Assets — host white papers, PDFs, or other downloadable content (local or remote storage).
  • Forms — Campaign Forms (used inside campaign workflows) or Standalone Forms (embedded anywhere), built with a drag-and-drop field/action editor.
  • Landing Pages — theme-based or visual-builder pages for opt-ins, webinars, gated content.
  • Campaigns — drag-and-drop drip workflows driven by sources (segment/form), actions (send email, adjust points), decisions (opens/visits), and conditions (field match).
  • Emails — Triggered (campaign/form/points-driven, repeatable) or Segment (one-time newsletter-style) types, built in the visual editor.
  • Points — assign/subtract points on contact actions (Point Actions) and fire automated responses once a threshold is hit (Point Triggers), for lead scoring.

Next Steps

Mautic is running on Ubuntu 24.04 with a full LEMP stack, TLS, and cron-driven background processing. From here:

  • Build a lead-scoring model with Points and route hot leads via a Point Trigger
  • Wire a Standalone Form + Landing Page combo for a lead-gen campaign
  • Segment contacts by engagement and connect a drip Campaign for nurture sequences

For the full guide with additional tips, visit the original article on Vultr Docs.

Top comments (0)