Come installare SuiteCRM con Nginx su Ubuntu 16.04

SuiteCRM è un open source software CRM (Customer Relationship Management) basate su PHP. È un fork del popolare software CRM 'SugarCRM', and has become more popular after 'SugarCRM' decided to stop the development of the free version. SuiteCRM has been nominated as the best open source CRM software on BOSSIE 2015 e 2016.

In questo tutorial, I will show you step-by-step how to install the open source CRM 'SuiteCRM'. The software will be running under the Nginx web server with MariaDB database and using the Ubuntu 16.04 sistema.

Che cosa faremo

  1. Installare il server Nginx Web
  2. Install and Configure PHP-FPM
  3. Installare e configurare MariaDB
  4. Download and Configure SuiteCRM
  5. SuiteCRM Web Installer
  6. Final steps


  • Ubuntu 16.04 Server
  • Privilegi di root

Passo 1 - Installare il server Nginx Web

SuiteCRM is a web based software, and it needs a web server. We can use Apache or Nginx for this software. In questo tutorial, we will be using the Nginx web server instead of the Apache web server.

Connect to your Ubuntu server and update the repository.

SSH [email protected]
sudo apt aggiornamento

Now install the Nginx web server using the apt command in the following way.

apt install -y nginx

Dopo l'installazione, start nginx and enable it to launch automatically every time at system boot.

systemctl start nginx
systemctl enable nginx

The Nginx web server is installed, and it's running under the default HTTP port 80. Check it using the netstat command, or you can use curl to see the HTTP status code.

netstat - plntu
curl -I localhost

Install Nginx

Passo 2 - Install and Configure PHP-FPM

SuiteCRM is compatible with multiple PHP versions. In questo tutorial, we will be using the newest version PHP 7.0 for SuiteCRM installation.

Install PHP and PHP-FPM 7 along with other required extensions using the following apt command.

apt install -y php7.0-fpm php7.0-mcrypt php7.0-imap php7.0-curl php7.0-cli php7.0-mysql php7.0-gd php7.0-xsl php7.0-json php7.0-intl php-pear php7.0-dev php7.0-common php7.0-mbstring php7.0-zip php-soap libcurl3 curl

Dopo l'installazione è completa, go to the PHP configuration directory and edit php.ini files for both 'cli' and 'fpm' configuration.

cd /etc/php/7.0/

Edit php.ini files.

vim cli/php.ini
vim fpm/php.ini

Change the max upload file size value. SuiteCRM needs at least 6MB, but we'll set 100MB as the value.

upload_max_filesize = 100M

Uncomment the CGI line (shown below) and change the value to 0.


For the sessions path configuration, uncomment the line below.

session.save_path = "/var/lib/php/sessions"

Questo è tutto. Save these changes and exit.

Ora, we need to create a new directory for PHP sessions files and change the owner of the directory to 'www-data' user and group.

mkdir -p /var/lib/php/sessions
chown -R www-data:www-data /var/lib/php/sessions

PHP and PHP-FPM configuration has been completed. Now start the service and enable it to launch every time at system boot.

systemctl start php7.0-fpm
systemctl enable php7.0-fpm

By default on the Ubuntu system, PHP-FPM will run under the sock file instead of using system port. Check it using the netstat command below.

netstat -pl | grep php

And make sure the result you see is similar to what's shown in the following screenshot.

Install PHP

Passo 3 - Installare e configurare MariaDB

In questo passaggio, we will install MariaDB and configure the root password. Then configure a new database for SuiteCRM installation.

Install MariaDB using the apt command below.

apt install -y mariadb-server mariadb-client

Dopo l'installazione, start the service and enable it to launch every time at system boot.

systemctl start mysql
systemctl enable mysql

Prossimo, configure the MariaDB root password using the 'mysql_secure_installation' command as below.


You will be asked about the configuration, type 'Y' and press 'Enter'.

Set root password? [Y/n] Y
New password:
Re-enter new password:
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

MariaDB root password has been configured.

Now we will create a new database and user for SuiteCRM installation. Create a database named 'suitecrm_db', and a new user 'crmadmin' with password 'hakase-labs123'. Connect to the mysql shell and run the following mysql queries.

mysql -u root -p
Type your password:
CREATE DATABASE suitecrm_db;
CREATE USER 'crmadmin'@'localhost' IDENTIFIED BY 'hakase-labs123';
GRANT ALL PRIVILEGES ON suitecrm_db.* TO 'crmadmin'@'localhost';

Install and configure the MariaDB database

MariaDB database configuration for SuiteCRM installation has been completed.

Passo 4 - Download and Configure SuiteCRM

In questo passaggio, we will do some tasks that'll prepare the system for SuiteCRM installation. We will download the SuiteCRM source code, configure UFW Firewall, generate Letsencrypt certificates, and configure nginx virtual host for SuiteCRM.

- Download SuiteCRM Source Code

The suiteCRM source code is available on Github. Make sure the git command installed on your system. Or if you do not have a git package, install it with the apt command below.

apt install -y git

Now go to the '/opt' directory and clone the repository using the following git clone command.

CD/opt /
git clone suitecrm

Go to the suitecrm directory and create a new 'cache' directory. Then change the permission of some files and directories, e infine, we need to change the ownership permissions for the 'suitecrm' directory to 'www-data' user and group.

cd /opt/suitecrm
mkdir -p /opt/suitecrm/cache
chmod -R 775 cache custom modules themes data upload config_override.php
chown www-data:www-data -R /opt/suitecrm

Download and install SuiteCRM

SuiteCRM source code has been downloaded.

- Configure UFW Firewall

Su Ubuntu, we will be using the ufw firewall. Open new ports HTTP, HTTPS, and SSH using the ufw commands as shown below.

ufw allow ssh
ufw allow http
ufw allow https

Now start the firewall and enable it to launch every time at system boot using ufw enable command.

ufw enable

Type 'y' and press Enter to enable the firewall.

Configure UFW Firewall

If you want to check the firewall status, use the ufw status command.

ufw status

And you will get the firewall status including what ports you have added.

Firewall Status

- Generate Letsencrypt Certificates

In questo tutorial, SuiteCRM will use HTTPS for more secure connection between client and server. Per questo scopo, we will be using free SSL certificate from Letsencrypt.

Before generating certificate files, we need to install letsencrypt client agent on the system. It's available in the Ubuntu repository, so install it with the apt command below.

apt install -y letsencrypt

After installing letsencrypt, we need to stop nginx service before generating certificate files.

systemctl stop nginx

Now generate SSL Certificate files using the letsencrypt command below.

letsencrypt certonly --standalone -d

Nota: Il --standalone option will create a temporary web server on the system, so we need to stop the Nginx web server before generating certificate files.

You will be asked about your email address for renewing notification. Type your email address and click 'OK'.

Create Let's Encrypt certificate

For the Letsencrypt Agreement, choose 'Agree' and press Enter.

Accept license agreement

New Letsencrypt SSL has been generated in the '/etc/letsencrypt/live/' directory.

SSL certificate has been generated

- Configure Nginx Virtual host for SuiteCRM

Go to the Nginx configuration directory and create a new virtual host file 'suitecrm' in the 'sites-available' directory.

cd /etc/nginx
vim sites-available/suitecrm

Paste the following Nginx configuration there.

# Server Config - hakase-labs
server {
listen 80;
# Automatically redirect to HTTPS
return 301 https://$host$request_uri;
# Nginx SSL for SuiteCRM
server {
# Enable http2
listen 443 http2 ssl;
# SSL Config
ssl_certificate /etc/letsencrypt/live/;
ssl_certificate_key /etc/letsencrypt/live/;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
client_max_body_size 50M;
index index.php index.html index.htm;
root /opt/suitecrm;
location / {
root /opt/suitecrm;
index index.php index.html index.htm;
error_page 500 502 503 504 /50x.html;
error_log /var/log/nginx/;
location = /50x.html {
root /var/www/html;
## Images and static content is treated different
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml|svg|wgoff2)$ {
access_log off;
expires max;
root /opt/suitecrm;
location ~ .php$ {
try_files $uri =404;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
location ~ /.ht {
deny all;

Salvare e uscire.

Now activate the virtual host, test the configuration, and make sure there is no error. Then restart the web server.

ln -s /etc/nginx/sites-available/suitecrm /etc/nginx/sites-enabled/
Nginx -t
systemctl riavvio nginx

Configure the virtualhost file

System configuration for SuiteCRM installation has been completed.

Passo 5 - SuiteCRM Web Installer

Open your web browser and type the SuiteCRM URL in the address bar, il mio è

You will be redirected to the HTTPS connection and the install.php page.

On the page that appears, you will see the GNU AFFERO License - check on the 'I Accept' and click 'Next'.

SuiteCRM Installer

Now you will get the page about system environment for SuiteCRM installation.

Make sure all results are 'OK' as shown in the picture below.

System check

Click 'Next' to continue.

Next comes database and admin user configuration. Type your database info, dbname 'suitecrm_db', dbuser 'crmadmin' with password 'hakase-labs123'. And type your admin user, password, and email as shown below.

Database and site configuration

Scroll to the bottom and click 'Next' to continue installing SuiteCRM.

Wait for a moment for the installation, and when it's complete, you will be redirected to the login page as below.

SuiteCRM login

Type your admin user and password, and click the 'Log in' button.

Now you'll be able to see the default SuiteCRM dashboard.

SuiteCRM dashboard

SuiteCRM has been installed with Nginx web server on the Ubuntu 16.04 sistema.

Passo 6 - Final steps

For this last step, we will create a new Cron job under www-data user.

Run the command below to add a new Cron job.

sudo crontab -e -u www-data

Paste Cron script configuration below.

*    *    *    *    *     cd /opt/suitecrm; php -f cron.php > /dev/null 2>&1

Salvare e uscire. Then restart the Cron service.

systemctl restart cron

The SuiteCRM installation on Ubuntu 16.04 has been completed.



Lasciare una risposta