How to Self-Host Mautic on a VPS: Email Marketing Automation Without Monthly Fees
Mautic is the leading open-source marketing automation platform — it handles email campaigns, lead scoring, drip sequences, landing pages, form capture, contact segmentation, and A/B testing. Mailchimp charges $35–$350/month depending on list size. Self-hosting Mautic on a VPS eliminates the per-contact billing entirely — you pay only for your VPS and your email delivery service (SendGrid, Amazon SES, or Mailgun charge fractions of a cent per email).
What Mautic Provides
- Email campaigns: One-time broadcast emails to segmented contact lists
- Drip campaigns: Automated sequences triggered by actions or time intervals
- Contact management: Import, segment, tag, and score contacts
- Lead capture: Embedded forms, landing pages, and website tracking
- A/B testing: Subject line and content variants with statistical comparison
- CRM integration: Sync with Salesforce, HubSpot, SugarCRM via plugins
Server Requirements
- Minimum 2 GB RAM (4 GB recommended for active campaigns)
- PHP 8.1–8.2, Apache or Nginx, MariaDB or MySQL
- A domain with proper SPF, DKIM, and DMARC records
- An external transactional email service (SendGrid, SES, or Mailgun) for deliverability
Step 1: Install LAMP Stack
<code">sudo apt update && sudo apt upgrade -y sudo apt install -y apache2 mariadb-server php8.2 php8.2-fpm \ php8.2-mysql php8.2-xml php8.2-curl php8.2-gd php8.2-mbstring \ php8.2-zip php8.2-imap php8.2-intl php8.2-bcmath php8.2-apcu \ libapache2-mod-php8.2 unzip git # Enable Apache modules sudo a2enmod rewrite ssl headers php8.2 sudo systemctl enable apache2 mariadb
Step 2: Configure PHP for Mautic
<code">sudo nano /etc/php/8.2/apache2/php.ini
<code">memory_limit = 512M upload_max_filesize = 64M post_max_size = 64M max_execution_time = 300 date.timezone = UTC ; OPcache opcache.enable = 1 opcache.memory_consumption = 128
Step 3: Create Database
<code">sudo mysql -u root
<code">CREATE DATABASE mautic CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'mautic'@'localhost' IDENTIFIED BY 'StrongMauticPassword!'; GRANT ALL PRIVILEGES ON mautic.* TO 'mautic'@'localhost'; FLUSH PRIVILEGES; EXIT;
Step 4: Download Mautic
<code"># Download latest Mautic release cd /var/www sudo wget https://github.com/mautic/mautic/releases/download/5.1.1/mautic-5.1.1.zip sudo unzip mautic-5.1.1.zip -d mautic sudo rm mautic-5.1.1.zip sudo chown -R www-data:www-data /var/www/mautic
Step 5: Apache Virtual Host
<code">sudo nano /etc/apache2/sites-available/mautic.conf
<code"><VirtualHost *:80>
ServerName mautic.yourdomain.com
Redirect permanent / https://mautic.yourdomain.com/
</VirtualHost>
<VirtualHost *:443>
ServerName mautic.yourdomain.com
DocumentRoot /var/www/mautic
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/mautic.yourdomain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mautic.yourdomain.com/privkey.pem
<Directory /var/www/mautic>
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/mautic_error.log
CustomLog ${APACHE_LOG_DIR}/mautic_access.log combined
</VirtualHost>
<code">sudo a2ensite mautic sudo a2dissite 000-default sudo nginx -t 2>/dev/null; sudo apachectl configtest sudo systemctl reload apache2 sudo certbot --apache -d mautic.yourdomain.com
Step 6: Web Installer
- Visit
https://mautic.yourdomain.com - Follow the installation wizard — enter database credentials
- Create your admin account
- Complete the setup wizard
Step 7: Configure Transactional Email Sending
Never send marketing email from your VPS’s local mail server — you’ll be blacklisted. Use a transactional email service:
In Mautic Admin → Settings → Configuration → Email Settings:
<code"># SendGrid configuration: Mailer Transport: Sendgrid API Sendgrid API Key: SG.your_api_key_here # OR Amazon SES (SMTP): Mailer Transport: SMTP SMTP Host: email-smtp.us-east-1.amazonaws.com SMTP Port: 587 SMTP Security: TLS Username: AKIAIOSFODNN7EXAMPLE Password: your_ses_smtp_password
Step 8: Set Up Cron Jobs (Critical)
Mautic relies on cron jobs for sending emails, processing contacts, and running automations. Without these, nothing sends:
<code">sudo crontab -u www-data -e
<code"># Process email queue and send campaigns (every 5 minutes) */5 * * * * php /var/www/mautic/bin/console mautic:emails:send >> /var/log/mautic-cron.log 2>&1 # Process campaign actions (every 5 minutes) */5 * * * * php /var/www/mautic/bin/console mautic:campaigns:trigger >> /var/log/mautic-cron.log 2>&1 # Update contact segments (every 15 minutes) */15 * * * * php /var/www/mautic/bin/console mautic:segments:update >> /var/log/mautic-cron.log 2>&1 # Process webhooks (every minute) * * * * * php /var/www/mautic/bin/console mautic:webhooks:process >> /var/log/mautic-cron.log 2>&1 # Social monitoring (hourly) 0 * * * * php /var/www/mautic/bin/console mautic:social:monitoring >> /var/log/mautic-cron.log 2>&1
Step 9: Email Authentication (SPF, DKIM, DMARC)
Without proper email authentication, campaigns go to spam. Configure at your DNS provider:
<code"># SPF record yourdomain.com TXT "v=spf1 include:sendgrid.net ~all" # DKIM (provided by your email service — copy from their DNS settings) s1._domainkey.yourdomain.com TXT "v=DKIM1; k=rsa; p=MIGfMA0..." # DMARC _dmarc.yourdomain.com TXT "v=DMARC1; p=quarantine; pct=100; rua=mailto:dmarc@yourdomain.com"
Getting Started
Mautic requires 2 GB RAM minimum; 4 GB is recommended for lists over 10,000 contacts with active automations. Ubuntu VPS plans at VPS.DO with NVMe storage handle Mautic’s database queries efficiently. For organizations currently paying $100+/month for Mailchimp or ActiveCampaign, self-hosted Mautic on a $20/month VPS plus $10–$50/month for email delivery (Amazon SES at $0.10/1,000 emails) reduces marketing infrastructure cost by 80%.
Conclusion
Self-hosted Mautic delivers enterprise marketing automation features — email campaigns, drip sequences, contact scoring, A/B testing, and CRM integration — at VPS cost plus email delivery fees. The cost advantage over SaaS alternatives grows with list size: Mautic’s cost doesn’t increase with contacts, only with the VPS plan needed to handle the database and queue volume. Configure cron jobs correctly and use a reputable transactional email service for reliable delivery.