Skip to content

Instantly share code, notes, and snippets.

@ThinkLikeLinux
Last active September 20, 2020 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThinkLikeLinux/198f03245c66a64e1b7fdc5c56a53b2b to your computer and use it in GitHub Desktop.
Save ThinkLikeLinux/198f03245c66a64e1b7fdc5c56a53b2b to your computer and use it in GitHub Desktop.
How to install Mautic on Ubuntu 18.04 #mautic
If you need Mautic installation, contact with me:
Telegram:@ThinkLikeLinux
email:thinklikelinux@gmail.com
WhatsApp:+8801309824364
Skype:live:.cid.bd73b6d4d960b474
#==========================================================#
#!/bin/sh
sudo apt update && sudo apt-get upgrade --fix-missing
sudo apt install build-essential checkinstall
sudo apt install ubuntu-restricted-extras
# NGINX SETUP
sudo apt-get install nginx
sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl restart nginx
sudo systemctl status nginx
sudo nginx -T
# MySQL Setup
sudo apt install mysql-server
sudo mysql_secure_installation
sudo service mysql start
sudo service mysql enable
sudo service mysql restart
mysql --version
# Create MySQL DB, User
sudo mysql -u root -p
CREATE DATABASE mautic DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
GRANT ALL ON mautic.* TO 'umautic'@'localhost' IDENTIFIED BY 'M@utic69';
use mautic;
FLUSH PRIVILEGES;
EXIT;
#Insatll mautic
sudo wget https://www.mautic.org/download/latest
sudo apt install unzip
sudo unzip latest -d /var/www/mautic/
sudo chown -R www-data:www-data /var/www/mautic/
#Install PHP
sudo apt-get install php7.2 php7.2-cli php7.2-fpm php7.2-mysql php7.2-json php7.2-opcache php7.2-mbstring php7.2-xml php7.2-gd php7.2-curl
#Add this
sudo nano /etc/nginx/nginx.conf
# set client body size to 2M #
client_max_body_size 2M;
#Use your favorite editor to create a configuration file for NGINX server block and edit it like below.
sudo nano /etc/nginx/sites-enabled/default
server {
listen 80;
listen [::]:80;
server_name mautic.example.com;
root /var/www/mautic;
error_log /var/log/nginx/mautic.error;
access_log /var/log/nginx/mautic.access;
client_max_body_size 20M;
index index.php index.html index.htm index.nginx-debian.html;
location / {
# try to serve file directly, fallback to app.php
try_files $uri /index.php$is_args$args;
}
location ~ /(mtc.js|1.js|mtracking.gif|.*\.gif|mtc) {
# default_type "application/javascript";
try_files $uri /index.php$is_args$args;
}
# redirect some entire folders
rewrite ^/(vendor|translations|build)/.* /index.php break;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
#Note: If you install Mautic on iRedMail server, you should use the TCP socket instead.
#fascgi_pass 127.0.0.1:9999
}
location ~* ^/index.php {
# try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
#Note: If you install Mautic on iRedMail server, you should use the TCP socket instead.
#fascgi_pass 127.0.0.1:9999
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
# 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;
}
# Deny all attempts to access hidden files/folders such as .htaccess, .htpasswd, .DS_Store (Mac), etc...
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
# Deny all grunt, composer files
location ~* (Gruntfile|package|composer)\.(js|json)$ {
deny all;
access_log off;
log_not_found off;
}
# Deny access to any files with a .php extension in the uploads directory
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
# A long browser cache lifetime can speed up repeat visits to your page
location ~* \.(jpg|jpeg|gif|png|webp|svg|woff|woff2|ttf|css|js|ico|xml)$ {
access_log off;
log_not_found off;
expires 360d;
}
}
##paste and save them
sudo nginx -t
sudo systemctl reload nginx
#mautic #mautic_install #mautic_setup
#mautic #install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment