How to install Mautic on EE in a subdomain

Folks, hello to all.

I need help to install the mautic in two steps.

First I need to creat a subdomain in a domain that I already have mautic.domain.com Second is create a mysql instance to connect the mautic and make this works, but I dont know the user and password to connect into domain.com:22222

thank you all

Robson

I don’t know what Mautic is.

But if it is a standard PHP script all you need is:

ee site create mautic.domain.com --mysql

Then take note of the MySQL credentials that will appear on your screen. EE will also create a file named ee-config.php on /var/www/mautic.domain.com.

thanks for the information, I think something is doing wrong with my maria db check the error message

Running pre-update checks, please wait… Setting up NGINX configuration [Done] Setting up webroot [Done] Setting up database Oops Something went wrong !! Calling cleanup actions … Reload : nginx [OK] Check logs for reason tail /var/log/ee/ee.log & Try Again!!!

I’ve searched a lot to know how to install Mautic on EE in a subdomain. Following steps is what works for me (Ubuntu 16.04/Debian 8 | Mautic v2.9.0). Hope it help.

1. Create a subdomain with SSL (let’sEncrypt recently does not support wildcard SSL, wait til Jan 2018):

ee site create mautic.domain.com --mysql --le

REMEMBER to note down: database name, user & password.

2. Get to the folder and download Mautic:

cd /var/www/mautic.domain.com/htdocs/
wget https://s3.amazonaws.com/mautic/releases/2.9.0.zip

3. Unzip and delete zipped files:

unzip 2.9.0.zip
rm 2.9.0.zip

if upzip is not installed, execute this command first:

apt install unzip

4. Change owner of the folder:

chown -R www-data:www-data .

chmod -R g+rw .

5. Configuration for the site:

  • Edit file (Select all > Delete > Paste):

/etc/nginx/sites-available/mautic.domain.com

  • With the following code:

      server {
      listen 80;
      listen [::]:80;
      server_name mautic.domain.com www.mautic.domain.com;
    
      access_log /var/log/nginx/mautic.domain.com.access.log rt_cache;
      error_log /var/log/nginx/mautic.domain.com.error.log;
    
      root /var/www/mautic.domain.com/htdocs;
    
      index index.php index.html index.htm;
    
      charset utf-8;
    
      # redirect index.php to root
      rewrite ^/index.php/(.*) /$1  permanent;
    
      # redirect some entire folders
      rewrite ^/(vendor|translations|build)/.* /index.php break;
    
      location / {
          try_files $uri /index.php$is_args$args;
      }
      location ~ \.php$ {
          try_files $uri =404;
          include fastcgi_params;
          fastcgi_pass php;
      }
    
      # Deny everything else in /app folder except Assets folder in bundles
      location ~ /app/bundles/.*/Assets/ {
          allow all;
          access_log off;
      }
      location ~ /app/ { deny all; }
    
      # Deny everything else in /addons or /plugins folder except Assets folder in bundles
      location ~ /(addons|plugins)/.*/Assets/ {
          allow all;
          access_log off;
      }
      location ~ /(addons|plugins)/ { deny all; }
    
      # Deny all php files in themes folder
      location ~* ^/themes/(.*)\.php {
          deny all;
      }
    
      # Don't log favicon
      location = /favicon.ico {
          log_not_found off;
          access_log off;
      }
    
      # Don't log robots
      location = /robots.txt  {
          access_log off;
          log_not_found off;
      }
    
      # Deny yml, twig, markdown, init file access
      location ~* /(.*)\.(?:markdown|md|twig|yaml|yml|ht|htaccess|ini)$ {
          deny all;
          access_log off;
          log_not_found off;
      }
    
      include /var/www/mautic.domain.com/conf/nginx/*.conf;
      }
    

6. Edit php.ini file in:

/etc/php/5.6/fpm/php.ini

Add the following line to the PHP configuration section:

always_populate_raw_post_data = -1

7. Restart the stack:

ee stack restart

8. Access mautic.domain.com to complete the installation process.

You may have to create/sign up/… SMTP server before the installation process.

9. Enjoy!

@bravenguyen

I’ve installed Mautic on domain.com successfully because on subdomain it did not work! :sweat:

Tested your tutorial on a fresh ee (Ubuntu 16.04 LTS on Linode).

Did you set up your main site as **www.**domain.com instead of naked domain as domain.com? If not, maybe that’s the problem.

Hey @bravenguyen I’ve successfully installed Mautic with your instructions, but I’m having problems with tracking js. I keep getting not found errors.

Hi @goranculibrk

Try to switch to PHP7. PHP7 solved my problem the same as yours Execute the following command to switch:

ee site update mautic.domain.com --php7

After that, don’t forget to edit the file in

/etc/nginx/sites-available/mautic.domain.com

The same content as above but except the following (for php7):

location ~ \.php$ {
    try_files $uri =404;
    include fastcgi_params;
    fastcgi_pass php7;
    }

Hope it help!

What should I do to make Mautic running properly under ee site create domain.com command?

I’m facing issues about non-www redirection on my site.