Open-source marketing automation does not have to mean giving up your data to a SaaS vendor. Mautic puts email campaigns, contact tracking, and lead nurturing under your own roof. Running it on Ubuntu 24.04 takes more effort than signing into HubSpot, but the reward is full control over your stack, your costs, and your customer data. You decide when to update, how to scale, and where your information lives.
Before you start, point a domain at your server and make sure your Ubuntu 24.04 instance has at least 2 GB of RAM. Mautic is not lightweight; PHP will consume memory when it rebuilds large segments or processes campaign logic. If you plan to send to thousands of contacts, 4 GB makes the experience far smoother.
Build the LEMP Foundation
Mautic expects a LEMP stack: Nginx, MySQL, and PHP. On Ubuntu 24.04, the default PHP version is 8.3, which works well with current Mautic releases. Start by updating your package list, then install Nginx and MySQL Server. After that, pull in PHP-FPM and the exact extensions Mautic needs:
- php-fpm
- php-mysql
- php-imap
- php-curl
- php-gd
- php-xml
- php-mbstring
- php-zip
- php-intl
- php-bcmath
Each extension serves a real purpose. The IMAP extension reads bounce messages and unsubscribe replies. GD handles image processing for thumbnails. Mbstring and Intl manage character sets and translations across languages. BCMath gives you precise math for lead scoring and currency calculations. Do not skip any of them, or the installer will complain halfway through.
If Apache is already installed, remove it. Both web servers want port 80 and 443. Running them side by side causes silent failures that are frustrating to debug. A clean apt remove apache2 followed by apt autoremove prevents that headache entirely.
Tune PHP and the Database
Mautic’s installer and background jobs are memory-hungry. Open your PHP-FPM configuration file, located at /etc/php/8.3/fpm/php.ini, and raise the memory limit to 512 MB. Set the upload size to 50 MB so you can import contact lists and asset bundles without hitting arbitrary walls. After saving, restart PHP-FPM to apply the changes. While you are at it, bump post_max_size to match your upload limit; otherwise PHP rejects large multipart form submissions even when upload_max_filesize looks correct.
Next, create a dedicated MySQL database and user. Call the database whatever you like, but keep the username and password in a password manager. Mautic stores every contact action, campaign decision, and email open event in these tables, so granting broad privileges to a single-purpose account limits exposure if something else on the server is compromised.
Install Mautic and Its Tooling
Download the latest stable Mautic release and extract it into /var/www/html/mautic. Set the directory owner to www-data so the web server can write cache files, logs, and local configuration updates. On Ubuntu, that means running chown -R www-data:www-data /var/www/html/mautic.
You also need Composer and npm installed on the server. Composer resolves PHP dependencies, and even if you deploy from the pre-built release archive, you will need Composer later when adding marketplace plugins or running manual updates. Npm matters if you ever customize themes or build frontend assets from source. Having both tools ready now saves you from scrambling when the project evolves.
Configure Nginx and Lock It Down
Your Nginx virtual host should point its root directory to /var/www/html/mautic and treat index.php as the default index. Route PHP requests to the Unix socket that PHP-FPM opens, typically at /run/php/php8.3-fpm.sock. A solid server block includes a try_files directive that falls back to the front controller, plus a location block that denies access to hidden files starting with a dot. Mautic ships with .htaccess files meant for Apache, but Nginx ignores them, so explicit deny rules in your virtual host keep your logs and temp directories private.
Before you run the web-based installer, get a TLS certificate. Use Certbot with the Nginx plugin to pull a free Let’s Encrypt certificate and automatically rewrite your HTTP traffic to HTTPS. Mautic handles login credentials and contact data; there is no excuse for serving it over plain text.
Cron Jobs Are the Engine
Bước này là bắt buộc. Nếu không có các tác vụ được lập lịch, Mautic chỉ là một bảng điều khiển vô dụng. Ứng dụng sẽ xếp hàng các hành động chiến dịch, việc gửi email và tính toán lại phân khúc trong cơ sở dữ liệu, sau đó dựa vào dòng lệnh để xử lý chúng.
Thiết lập các cron job cho người dùng Mautic để xử lý các nhiệm vụ chạy ngầm này:
- Cập nhật các phân khúc (segments)
- Chạy các chiến dịch (campaigns)
- Gửi email
- Lấy thông tin email bị trả về (bounces)
Trong thực tế, điều đó có nghĩa là gọi các lệnh console của Mautic theo các khoảng thời gian khác nhau. Việc xây dựng lại phân khúc có thể chạy hàng giờ. Các trình kích hoạt chiến dịch và xử lý hàng đợi email thường cần khoảng thời gian dày hơn, cứ mỗi năm đến mười lăm phút tùy thuộc vào khối lượng. Việc lấy thông tin bounce qua IMAP nên được chạy đủ thường xuyên để uy tín người gửi (sender reputation) của bạn không bị ảnh hưởng bởi các khiếu nại spam không được kiểm soát. Hãy theo dõi syslog hoặc đầu ra của cron để xác nhận rằng chúng hoàn tất mà không gặp lỗi bộ nhớ.
Sử dụng Nền tảng
Sau khi trình cài đặt hoàn tất và cron đã hoạt động trơn tru, hãy đăng nhập vào bảng điều khiển. Giao diện tập trung vào ba thành phần chính: contacts (liên hệ), segments (phân khúc) và campaigns (chiến dịch).
Sử dụng trình xây dựng chiến dịch kéo-và-thả để thiết kế các luồng công việc email (email workflows). Một người đăng ký mới tham gia vào luồng, đợi một ngày, nhận được tin nhắn chào mừng và phân nhánh dựa trên việc họ có nhấp vào một liên kết hay không. Trong khi đó, hệ thống Điểm (Points system) sẽ âm thầm chấm điểm các lead khi họ truy cập trang giá cả hoặc mở các thông báo sản phẩm. Bạn sẽ quyết định các ngưỡng để xác định một "hot lead" xứng đáng để thực hiện cuộc gọi bán hàng.
Các phân khúc (segments) nhóm các liên hệ một cách tự động theo các quy tắc mà bạn định nghĩa. Bạn có thể phân khúc tất cả những người đã mở một chiến dịch trong ba mươi ngày qua, hoặc tách biệt các liên hệ ở một quốc gia cụ thể. Các biểu mẫu (forms) trên các trang đích (landing pages) của bạn sẽ đổ dữ liệu trực tiếp vào các phân khúc này. Kết nối các thành phần lại với nhau và bạn sẽ có một chuỗi nuôi dưỡng (nurture sequence) tự động, phản ứng dựa trên hành vi thay vì gửi cùng một thông điệp cho toàn bộ danh sách của mình.
Công việc thực sự sau khi triển khai
Thiết lập Mautic trên Ubuntu 24.04 mới chỉ là sự khởi đầu. Hãy sao lưu cơ sở dữ liệu và thư mục /var/www/html/mautic của bạn trước mỗi lần cập nhật. Theo dõi nhật ký lỗi PHP khi bạn cài đặt các plugin mới. Kiểm tra đầu ra của cron sau khi bạn mở rộng danh sách liên hệ, vì một tác vụ hoàn thành trong vài giây với một nghìn liên hệ có thể bị quá thời gian (time out) khi lên đến năm mươi nghìn liên hệ.
Tự lưu trữ (Self-hosting) là sự đánh đổi giữa sự tiện lợi của một dịch vụ SaaS được quản lý với quyền kiểm soát hoàn toàn đối với dữ liệu marketing của bạn. Không có sự ràng buộc với nhà cung cấp (vendor lock-in), không có những bất ngờ về giá theo từng liên hệ, và không có bên thứ ba nào giữ dữ liệu phân tích của bạn làm con tin. Bạn sở hữu máy chủ, cơ sở dữ liệu và mối quan hệ với khán giả của mình. Đối với các đội ngũ sẵn sàng duy trì một máy chủ Linux và một vài biểu thức cron, sự đánh đổi đó thường rất xứng đáng.
