In this tutorial you will learn in a few minutes how to properly setup VPS server not only for Mautic, but also WordPress and other applications. And it will not hurt your head.
Our goals
- Install Mautic on own domain
- Install Mautic on HTTPS
- Budget 5$/month
- Without headache
- Mautic ready to use
1, Create 5$/month VPS
You can use any clean VPS with OS Ubuntu 16.04 x64 or Ubuntu 18.04 x64, but we highly recommend:
2. Setup RunCloud
- Create RunCloud account
- Click Connect a New server
- Add IP address of your VPS created in Step 1
- RunCloud will generate script for your server
- Connect to VPS with root password in console (see in Step 1)
- Run script in console
- Wait few minutes to RunCloud setup your VPS
- Then store MySQL and runcloud password displayed in console
- Now your server is ready to manage as hosting with RunCloud
3. Create Mautic app in RunCloud
- create Web application on RunCloud
- choose PHP 7.2
4. Create database
- Create database user
- Create database with utf8mb4_bin collation
- Connect your database user to database
5. Target DNS A record of your Mautic domain to VPS IP address
Usually your domain provider allow your manage your DNS records.
6. Install free SSL certificate
This script https://github.com/rehmatworks/runcloud-letsencrypt add SSL certificate to your current apps and auto create SSL certificate with any new APP create on RunCloud.
- connect to server as root
- run: pip install rcssl; rcssl -i all; rcssl -a enable;
7. Copy Mautic files to server
- connect o server as runcloud
- run: ssh runcloud@ipaddress (password from Step 2)
- run: cd webapps/mautic
- run this script in console (don’t forget change Mautic version on begin of script)
- dont’ forget rewrite Mautic version in first line
MTC=2.15.0; URL=https://github.com/mautic/mautic/releases/download/${MTC}/${MTC}.zip; wget "${URL}"; unzip -o "${MTC}.zip"; rm "${MTC}.zip";
8. Install Mautic
- Go to your Mautic URL – in my case https://mautic.mtcextendee.com
- If everything OK should start standard Mautic install process
9. Install crons
This script install crons runs every minute for command:
- mautic:segments:update
- mautic:campaigns:update
- mautic:campaigns:trigger
Don’t forget edit first line of directory name of your app.
DIR="mautic"; wget -N https://raw.githubusercontent.com/mtcextendee/mautic-crons-runcloud/master/crons.txt; (crontab -l; echo "$(< crons.txt)"|replace DIR "$DIR")| crontab -;unlink crons.txt;
10. Setup permission
If your PHP app is having problems creating or writing to files or directories, the problem is almost always incorrect file ownership. Run in console something like this:
sudo chown -R runcloud:runcloud /home/runcloud/webapps/
11. Update PHP CLI version to 7.2
Mautic support PHP 7.2, but Runcloud default use in command PHP 7.3. This version returns few warnings. Change it with these lines:
sudo rm /usr/bin/php; sudo ln -s /RunCloud/Packages/php72rc/bin/php /usr/bin/php;
12. Enable disabled_functions
Runcloud by default disabled few function, maybe you should require for your app. For example Mautic return warning for disabled ignore_user_abort, Multiple Bundle return error for disabled shell_exec and symlink. Apply lines for PHP 7.2.
nano /etc/php72rc/fpm.d/yourappname.conf systemctl restart php72rc-fpm
Now Mautic is ready to use. Have fun.