在本文中,您將學習安裝 莫蒂奇,一種開源營銷自動化工具。 設置過程的一部分將使用 Easy Engine 來自動部署 LAMP 堆棧。
您可以使用 Mautic 創建潛在客戶、管理在線營銷活動和登錄頁面。
在開始之前,您需要一個雲服務器實例,因為本教程面向生產就緒的公開設置,並且某些步驟還需要訪問 DNS 面板來設置您的域設置(如何設置您的公共域設置不是此處涵蓋)。
您可以從滿足以下要求的 VPS 開始:
– Ubuntu 16.04.03 64 位或最新版本
– 1 個中央處理器
– 2 GB 內存
– 30 GB 硬盤
1.檢查系統版本
一個。 登錄您的服務器並確保系統是最新的。
ssh root@yourserverip
lsb_release -a
例子:
root@newvps:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
灣如有必要,運行系統更新以安裝最新的系統補丁和升級。
apt update && apt upgrade -y
reboot
2. 檢查您的 DNS 配置
一個。 確保您的 DNS 設置正確,其中一條 A 記錄指向您的服務器 IP,而 CNAME 記錄中的“www”子域指向您的域。
dig www.yoursitedomain.net
例子:
user@workstation:~$ dig www.yoursitedomain.net
; <> DiG 9.9.5-9+deb8u14-Debian <> www.yoursitedomain.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9405
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.yoursitedomain.net. IN A
;; ANSWER SECTION:
www.yoursitedomain.net. 300 IN CNAME yoursitedomain.net.
yoursitedomain.net. 60 IN A yourserverip
;; Query time: 96 msec
;; SERVER: 192.168.10.1#53(192.168.10.1)
;; WHEN: Sat Sep 16 03:56:05 CST 2017
;; MSG SIZE rcvd: 68
3. 設置您的 VPS 名稱以匹配您的域
一個。 以 root 身份修改 Ubuntu 的 DNS 文件。
ssh root@yourserverip
sudo -i
cp -av /etc/hostname /etc/hostname.orig
cp -av /etc/hosts /etc/hosts.orig
echo "yoursitedomain.net" > /etc/hostname
echo -e "nyourserverip yoursitedomain.net yoursitedomain" >> /etc/hosts
hostname yoursitedomain.net
灣使用新的 DNS 設置重新啟動新實例並重新進入,新配置應該已經可以工作了。
reboot
ssh root@yourserverip
4. 使用 Easy Engine 準備應用程序部署
一個。 以 root 身份使用下面的命令行安裝 Easy Engine。
sudo -i
wget -qO ee rt.cx/ee && sudo bash ee
灣使用 Easy Engine 在服務器上部署 MySQL、NGINX 和 PHP,包括對 Let’s Encrypt 的支持。
ee site create yoursitedomain.net --mysql --letsencrypt
例子:
root@yoursitedomain:~# ee site create yoursitedomain.net --mysql --letsencrypt
Adding repository for MySQL, please wait...
Adding repository for NGINX, please wait...
Adding repository for PHP, please wait...
Updating apt-cache, please wait...
Installing packages, please wait...
Downloading MySQLTuner [Done]
Reload : postfix [OK]
Reload : nginx [OK]
Restart : php5.6-fpm[OK]
Reload : mysql [OK]
Running pre-update checks, please wait...
Setting up NGINX configuration [Done]
Setting up webroot [Done]
Setting up database [Done]
Reload : nginx [OK]
HTTP Auth User Name: easyengine
HTTP Auth Password : 4ZOQc2
Successfully created site https://yoursitedomain.net
Letsencrypt is currently in beta phase.
Do you wish to enable SSl now for yoursitedomain.net?
Type "y" to continue [n]:y
Please Wait while we fetch SSL Certificate for your site.
It may take time depending upon network.
Let's Encrypt successfully setup for your site
Your certificate and chain have been saved at /etc/letsencrypt/live/yoursitedomain.net/fullchain.pem
Configuring Nginx SSL configuration
Adding /var/www/yoursitedomain.net/conf/nginx/ssl.conf
Adding /etc/nginx/conf.d/force-ssl-yoursitedomain.net.conf
Added HTTPS Force Redirection for Site https://yoursitedomain.net
Creating Cron Job for cert auto-renewal
Reload : nginx [OK]
Congratulations! Successfully Configured SSl for Site https://yoursitedomain.net
Your cert will expire within 89 days.
root@yoursitedomain:~#
5. 下載並安裝 Mautic
一個。 使用應用程序的 Web 目錄從 GitHub 下載 Mautic 源代碼。
cd /var/www/yoursitedomain.net/
rm -rf htdocs
wget https://github.com/mautic/mautic/archive/master.zip
unzip master.zip
mv mautic-master htdocs
cd htdocs
灣下載並安裝 PHP Composer 以完成安裝過程。
apt -y install curl
curl -s https://getcomposer.org/installer | php
mv -v composer.phar /usr/local/bin/composer
composer install
cd ..
chown -R www-data: htdocs
6. 調整 PHP、MySQL 和 Nginx 以與您的 Mautic 應用程序配合使用
一個。 獲取 MySQL 服務器的 root 密碼。
cat /etc/mysql/conf.d/my.cnf
.
灣訪問您的 MySQL 服務器並為 Mautic 創建用戶和數據庫。
mysql -uroot -p
CREATE DATABASE mautic_data;
CREATE USER 'mautic_user'@'localhost' IDENTIFIED BY 'RRl4$3W7fvpdKd#OVNV';
GRANT ALL PRIVILEGES ON mautic_data.* TO 'mautic_user'@'localhost';
例子:
root@yoursitedomain:/var/www/yoursitedomain.net# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 27
Server version: 10.1.26-MariaDB-1~xenial mariadb.org binary distribution
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MariaDB [(none)]> CREATE DATABASE mautic_data;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> CREATE USER 'mautic_user'@'localhost' IDENTIFIED BY 'RRl4$3W7fvpdKd#OVNV';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON mautic_data.* TO 'mautic_user'@'localhost';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> quit
Bye
C。 更新 PHP FastCGI 的 PHP 配置。
sed -i "47ialways_populate_raw_post_data = -1" /etc/php/5.6/fpm/php.ini
d. 更新 Nginx 配置以修復啟用重定向到 SSL 站點版本時 Mautic 訪問其資產的問題。
cat "rewrite ^/index.php/(.*)$ /$1 last;" > /var/www/yoursitedomain.net/conf/nginx/urlfix.conf
e. 確保正確設置更改文件所有權。
chown www-data: /var/www/yoursitedomain.net/conf/nginx/urlfix.conf
F。 重啟 PHP FastCGI 和 Nginx 服務。
service php5.6-fpm restart
systemctl restart nginx
7. 運行 Mautic 安裝嚮導
一個。 打開瀏覽器並輸入此 URL:https://yoursitedomain.net 以啟動配置嚮導。
灣在安裝過程中,請確保輸入您的數據庫設置,如下所示:
數據庫設置
用戶:mautic_user
傳球:RRl4$3W7fvpdKd#OVNV
數據庫:mautic_data
C。 設置一個 admin 應用程序的用戶名和密碼(它們不應與您的數據庫用戶名和密碼相同)
Mautic 管理員
用戶: mautic-admin
傳球:F1e#vQueb+Jouwegibyu
d. 設置嚮導完成後,返回服務器控制台並添加這些 cronjobs。
# Setting up Mautic cron jobs,
# please refer to https://www.mautic.org/docs/en/setup/cron_jobs.html for further details
# Updating Contact Segments
0,15,30,45 * * * * /usr/bin/php /var/www/yoursitedomain.net/htdocs/app/console mautic:segments:update
# Campaign Updates
5,20,35,50 * * * * /usr/bin/php /var/www/yoursitedomain.net/htdocs/app/console mautic:campaigns:rebuild
# Email Delivery
10,25,40,55 * * * * /usr/bin/php /var/www/yoursitedomain.net/htdocs/app/console mautic:emails:send
C。 下載並部署 IP Lookup 庫以完成 mautic 的設置。
php /var/www/yoursitedomain.net/htdocs/app/console mautic:iplookup:download
chown -R www-data: /var/www/yoursitedomain.net
service php5.6-fpm restart
systemctl restart nginx
此時,您應該啟動並運行您的 Mautic 服務器,因此我建議您從網站官方開始 文件 了解如何設置您的營銷活動並為您的電子商務網站創建登錄頁面。