How to Install SuiteCRM with Nginx on CentOS 7

SuiteCRM is an open source CRM (Customer Relationship Management) software based on PHP. It is fork of the popular CRM software SugarCRM, and has become more popular after the team behind the latter decided to stop the development of the free version. SuiteCRM was nominated as the best open source CRM software at BOSSIE 2015 and 2016.

In this tutorial, we will show you how to install and configure SuiteCRM using Nginx as the Web server. The CRM software will run under the LEMP stack with HTTPS enabled. And for this purpose, we'll be using CentOS 7 as the main OS.

What we will do

  1. Install Nginx Web server
  2. Install and configure PHP-FPM
  3. Install and configure MariaDB
  4. Download and configure SuiteCRM
  5. Install SuiteCRM through Web installer
  6. Final configuration


  • CentOS 7 Server
  • Root privileges

Step 1 - Install Nginx Web server

The first step we must do to connect the server and install the basic stack for SuiteCRM. Connect to the server through SSH using the following command:

ssh [email protected]

After connecting as the root user, we need to install a third-party repository on our system. Specifically, we need to install the EPEL (Extra Package for Enterprise Linux) repository on the system before installing Nginx.

Install EPEL repository using the yum command in the following way:

yum -y install epel-release

Now we can install Nginx web server on the system.

yum -y install nginx

If the installation is complete, start the service and enable it to run automatically at the boot time using the systemctl command as shown below.

systemctl start nginx
systemctl enable nginx

Nginx web server is now installed, and by default, it's running on port 80. Check it using netstat or curl commands.

netstat -plntu
curl -I localhost

Make sure port 80 is on the 'LISTEN' status, and the curl command gives 200 HTTP status code in its output.

Check if Nginx listens on the correct ports

Step 2 - Install and configure PHP-FPM

In this step, we will install and configure PHP-FPM version 7 on the CentOS 7 server. By default, centOS doesn't provide repository for the new PHP version 7. So we need to add a different repository for PHP-FPM 7 installation.

Add new PHP 7 repository 'webtatic' to the system using the rpm command.

sudo rpm -Uvh

Now install PHP 7 packages and extensions using yum command as shown below.

sudo yum install -y php71w-fpm php71w-cli php71w-common php71w-imap php71w-gd php71w-mbstring php71w-mcrypt php71w-mysql php71w-xml

If the installation is complete, edit the default 'php.ini' configuration file using vim.

vim /etc/php.ini

Change the max upload file size for SuiteCRM installation to 100MB. At the very least, SuiteCRM needs more than 6MB.

upload_max_filesize = 100M

Uncomment the following CGI line and change the value to 0.


For the session path configuration, uncomment the line and change the path to '/var/lib/session' as shown below.

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

That's it. Save the changes and exit vim.

Now create a new directory for the session path and change the ownership permissions of the directory to 'nginx' user and group.

mkdir -p /var/lib/php/session
chown -R nginx:nginx /var/lib/php/session

Next, we need to edit the php-fpm configuration. For this, go to the '/etc/php-fpm.d' directory and edit the configuration file www.conf.

cd /etc/php-fpm.d/
vim www.conf

Now change user and group line to 'nginx'.

user = nginx
group = nginx

Instead of using the system port, PHP-FPM will be running under the unix socket file.

Change the 'listen' line:

listen = /var/run/php-fpm/php-fpm.sock

Set the permission for Unix socket file and ownership of the socket file as shown below.

listen.owner = nginx = nginx
listen.mode = 0660

That's it. Save the changes and exit the editor.

Now start PHP-FPM service and add it to start automatically at the boot time.

systemctl start php-fpm
systemctl enable php-fpm

With this, PHP-FPM is installed and running the socket file.

You  can check this using the netstat command:

netstat -pl | grep php

Make sure you see the php-fpm.sock file.

Configure PHP-FPM

Step 3 - Install and Configure MariaDB

In this step, we will install MariaDB, then start and enable it to launch everytime at system boot. And finally, we will create new database and user for SuiteCRM installation.

Install mariadb from the CentOS repository using the following yum command.

yum install -y mariadb mariadb-server

Start MariaDB service and the enable it to launch the boot time using the commands below.

systemctl start mariadb
systemctl enable mariadb

So MariaDB is now installed and running. Now, we need to configure the root password using 'mysql_secure_installation' command.


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

So MariaDB root password has been configured.

Next, we need to create a new database and a new user for SuiteCRM installation. For this, log in to the MySQL shell with user 'root' and your password.

mysql -u root -p

Create a new database named 'suitecrm_db' and a new user 'crmadmin' with password 'hakase-labs123'. All this can be done using the mysql queries below.

CREATE DATABASE suitecrm_db;
CREATE USER 'crmadmin'@'localhost' IDENTIFIED BY 'hakase-labs123';
GRANT ALL PRIVILEGES ON suitecrm_db.* TO 'crmadmin'@'localhost';

So database configuration for SuiteCRM installation has been completed.

Create SuiteCRM database

Step 4 - Download and Configure SuiteCRM

In this step, we will do some tasks for SuiteCRM installation. We will download the SuiteCRM source code, configure Firewalld, Generate new SSL Letsencrypt, and configure the nginx virtual host for SuiteCRM. So let's begin.

Download SuiteCRM

If not already, install git on your system using the yum command below.

yum -y install git

Now go to the '/opt' directory and download SuiteCRM code using git command as shown below.

cd /opt/
git clone suitecrm

Download SuiteCRM

After that, create a cache directory, change permissions for some files and directories in the suitecrm directory, and then change the owner of all suitecrm code to 'nginx' user and group.

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

So the suiteCRM code has been downloaded onto the server on '/opt/suitecrm/' directory.

Create direcctories

Configure Firewalld

If you do not have Firewalld running on your server, install it using the following command.

yum -y install firewalld

Start the service and enable it to run at the boot time.

systemctl start firewalld
systemctl enable firewalld

Next, we need to open new ports HTTP and HTTPS. It's used for SuiteCRM access. Run the following firewall-cmd commands for this.

firewall-cmd --add-service=http --permanent
firewall-cmd --add-service=https --permanent

Now reload firewalld rules using the following command.

firewall-cmd --reload

Configure the Firewall

So now, new HTTP and HTTPS port have been added to the Firewalld. If you want to see detail configuration, run the command below.

firewall-cmd --list-all

List Firewall settings

Generate New SSL Letsencrypt

In this tutorial, we will be using SSL for SuiteCRM access. And we will be using free SSL certificates from letsencrypt for that purpose.

To generate new SSL letsencrypt certificates, we need to first install the letsencrypt command tool 'certbot' to our system. It's available in the CentOS repository. Install certbot using the following yum command.

yum -y install certbot

When the certbot installation is complete, generate SSL certificate file for suiteCRM domain name ''.

Run the command below to generate SSL certificate files.

certbot certonly --standalone -d

You will be asked about the email address for renewing notification - type your email and press Enter to continue.

For the Letsencrypt TOS, type 'A' to agree and press Enter again. And for the share email address query, type 'N' and press Enter.

Create an SSL certificate

When the certificate generation is complete, you will get the result as below.

SSL certificate successfully created

New certificate files are generated in the '/etc/letsencrypt/live/' directory.

Configure SuiteCRM Nginx Virtual host

Go to the Nginx configuration directory '/etc/nginx', and create a new file suitecrm.conf file in the conf.d directory using Vim editor.

cd /etc/nginx/
vim conf.d/suitecrm.conf

There, paste SuiteCRM Nginx virtual host below.

# 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;

    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 /usr/share/nginx/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:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;

    location ~ /\.ht {
        deny all;


That's it. Save the change and exit Vim.

Now test nginx configuration and make sure there is no error. Once that is done, restart the service.

nginx -t
systemctl restart nginx

With this, the nginx configuration for SuiteCRM installation has been completed.

Configure Nginx for SuiteCRM

Step 5 - SuiteCRM Web Installer

Open your Web browser and visit the SuiteCRM domain name: ''.

You will be redirected to the HTTPS connection install.php, and you will get the page about GNU AFFERO License. Check the 'I Accept' box and click 'Next'.

SuiteCRM web installer

On the system environment page, make sure all the results are 'OK'.

Check prerequisites

And click 'Next' to continue.

Next comes admin and database configuration. Type your database info, such as dbname, dbuser, and dbpassword. For the admin configuration, type your username, email, and password.

Database settings

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

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

SuiteCRM Login

On this page, type the admin user and password, then press the 'Log in' button.

And you'll get the SuiteCRM Dashboard as shown below.

SuiteCRM dashboard

So SuiteCRM has been installed.

Step 6 - Final configuration

In this last step, we need to add configuration to the cronjob.

Basically, we need to create new cron as nginx user and group.

sudo crontab -e -u nginx

And paste the following configuration.

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

Save and exit.

That's it. The SuiteCRM installation with Nginx web server on CentOS 7 has been completed.


Share this page:

1 Comment(s)

Add comment

Please register in our forum first to comment.


By: Brant Stevens

Once the git clone is done, you need to run "composer install" from the suitecrm directory.


[[email protected] suitecrm]# composer install

Loading composer repositories with package information

Installing dependencies (including require-dev) from lock file

Package operations: 78 installs, 0 updates, 0 removals

  - Installing ezyang/htmlpurifier (v4.10.0): Loading from cache

  - Installing google/recaptcha (1.1.3): Downloading (100%)

  - Installing justinrainbow/json-schema (5.2.7): Downloading (100%)

  - Installing psr/http-message (1.0.1): Loading from cache

  - Installing paragonie/random_compat (v2.0.17): Downloading (100%)

  - Installing league/event (2.1.2): Downloading (100%)

  - Installing lcobucci/jwt (3.2.2): Downloading (100%)

  - Installing defuse/php-encryption (v2.2.0): Downloading (100%)

  - Installing league/oauth2-server (5.1.6): Downloading (100%)

  - Installing symfony/polyfill-mbstring (v1.8.0): Downloading (100%)

  - Installing true/punycode (v2.1.1): Loading from cache

  - Installing league/url (3.3.5): Loading from cache

  - Installing robrichards/xmlseclibs (3.0.1): Downloading (100%)

  - Installing onelogin/php-saml (3.0.0.x-dev 03efada): Cloning 03efada0d2

  - Installing psr/container (1.0.0): Loading from cache

  - Installing pimple/pimple (v3.2.3): Downloading (100%)

  - Installing nikic/fast-route (v1.3.0): Downloading (100%)

  - Installing container-interop/container-interop (1.2.0): Loading from cache

  - Installing slim/slim (3.10.0): Downloading (100%)

  - Installing psr/log (1.0.2): Loading from cache

  - Installing firebase/php-jwt (v5.0.0): Loading from cache

  - Installing tuupola/slim-jwt-auth (2.4.0): Downloading (100%)

  - Installing browserstack/browserstack-local (dev-master c81e909): Cloning c81e909641

  - Installing symfony/polyfill-ctype (v1.8.0): Downloading (100%)

  - Installing symfony/yaml (v3.4.12): Downloading (100%)

  - Installing symfony/finder (v3.4.12): Downloading (100%)

  - Installing symfony/event-dispatcher (v3.4.12): Downloading (100%)

  - Installing symfony/dom-crawler (v3.4.12): Downloading (100%)

  - Installing symfony/css-selector (v3.4.12): Downloading (100%)

  - Installing symfony/debug (v3.4.12): Downloading (100%)

  - Installing symfony/console (v3.4.12): Downloading (100%)

  - Installing symfony/browser-kit (v3.4.12): Downloading (100%)

  - Installing guzzlehttp/psr7 (1.4.2): Loading from cache

  - Installing guzzlehttp/promises (v1.3.1): Loading from cache

  - Installing guzzlehttp/guzzle (6.3.3): Downloading (100%)

  - Installing symfony/process (v3.4.12): Downloading (100%)

  - Installing facebook/webdriver (1.4.1): Downloading (100%)

  - Installing sebastian/recursion-context (1.0.5): Downloading (100%)

  - Installing sebastian/exporter (1.2.2): Downloading (100%)

  - Installing phpunit/php-text-template (1.2.1): Downloading (100%)

  - Installing doctrine/instantiator (1.0.5): Downloading (100%)

  - Installing phpunit/phpunit-mock-objects (2.3.8): Downloading (100%)

  - Installing codeception/stub (1.0.4): Downloading (100%)

  - Installing sebastian/diff (1.4.3): Downloading (100%)

  - Installing sebastian/comparator (1.2.4): Downloading (100%)

  - Installing sebastian/version (1.0.6): Downloading (100%)

  - Installing sebastian/global-state (1.1.1): Downloading (100%)

  - Installing sebastian/environment (1.3.8): Downloading (100%)

  - Installing phpunit/php-timer (1.0.9): Downloading (100%)

  - Installing phpunit/php-file-iterator (1.4.5): Downloading (100%)

  - Installing phpunit/php-token-stream (1.4.12): Downloading (100%)

  - Installing phpunit/php-code-coverage (2.2.4): Downloading (100%)

  - Installing webmozart/assert (1.3.0): Downloading (100%)

  - Installing phpdocumentor/reflection-common (1.0.1): Downloading (100%)

  - Installing phpdocumentor/type-resolver (0.3.0): Downloading (100%)

  - Installing phpdocumentor/reflection-docblock (3.2.2): Downloading (100%)

  - Installing phpspec/prophecy (1.7.6): Downloading (100%)

  - Installing phpunit/phpunit (4.8.36): Downloading (100%)

  - Installing codeception/phpunit-wrapper (6.0.10): Downloading (100%)

  - Installing behat/gherkin (v4.5.1): Downloading (100%)

  - Installing codeception/codeception (2.4.1): Downloading (100%)

  - Installing symfony/filesystem (v3.4.12): Downloading (100%)

  - Installing league/container (2.4.1): Downloading (100%)

  - Installing dflydev/dot-access-data (v1.1.0): Downloading (100%)

  - Installing grasmash/yaml-expander (1.4.0): Downloading (100%)

  - Installing consolidation/output-formatters (3.2.1): Downloading (100%)

  - Installing consolidation/log (1.0.6): Downloading (100%)

  - Installing grasmash/expander (1.0.0): Downloading (100%)

  - Installing consolidation/config (1.0.11): Downloading (100%)

  - Installing consolidation/annotated-command (2.8.4): Downloading (100%)

  - Installing consolidation/robo (1.3.0): Downloading (100%)

  - Installing fzaninotto/faker (v1.8.0): Downloading (100%)

  - Installing behat/transliterator (v1.2.0): Downloading (100%)

  - Installing jeroendesloovere/vcard (1.5.0): Downloading (100%)

  - Installing leafo/scssphp (dev-master 3d3fd50): Cloning 3d3fd50810

  - Installing mikey179/vfsstream (v1.4.0): Downloading (100%)

  - Installing hamcrest/hamcrest-php (v1.2.2): Downloading (100%)

  - Installing mockery/mockery (0.9.9): Downloading (100%)

paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)

lcobucci/jwt suggests installing mdanter/ecc (Required to use Elliptic Curves based algorithms.)

league/oauth2-server suggests installing indigophp/hash-compat (Polyfill for hash_equals function for PHP 5.5)

browserstack/browserstack-local suggests installing phpdocumentor/phpdocumentor (2.*)

symfony/event-dispatcher suggests installing symfony/dependency-injection ()

symfony/event-dispatcher suggests installing symfony/http-kernel ()

symfony/console suggests installing psr/log-implementation (For using the console logger)

symfony/console suggests installing symfony/lock ()

phpunit/phpunit-mock-objects suggests installing ext-soap (*)

sebastian/global-state suggests installing ext-uopz (*)

phpunit/php-code-coverage suggests installing ext-xdebug (>=2.2.1)

phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)

codeception/codeception suggests installing aws/aws-sdk-php (For using AWS Auth in REST module and Queue module)

codeception/codeception suggests installing codeception/phpbuiltinserver (Start and stop PHP built-in web server for your tests)

codeception/codeception suggests installing codeception/specify (BDD-style code blocks)

codeception/codeception suggests installing codeception/verify (BDD-style assertions)

codeception/codeception suggests installing flow/jsonpath (For using JSONPath in REST module)

codeception/codeception suggests installing league/factory-muffin (For DataFactory module)

codeception/codeception suggests installing league/factory-muffin-faker (For Faker support in DataFactory module)

codeception/codeception suggests installing phpseclib/phpseclib (for SFTP option in FTP Module)

codeception/codeception suggests installing stecman/symfony-console-completion (For BASH autocompletion)

codeception/codeception suggests installing symfony/phpunit-bridge (For phpunit-bridge support)

consolidation/output-formatters suggests installing symfony/var-dumper (For using the var_dump formatter)

consolidation/robo suggests installing henrikbjorn/lurker (For monitoring filesystem changes in taskWatch)

consolidation/robo suggests installing natxet/CssMin (For minifying CSS files in taskMinify)

consolidation/robo suggests installing patchwork/jsqueeze (For minifying JS files in taskMinify)

consolidation/robo suggests installing pear/archive_tar (Allows tar archives to be created and extracted in taskPack and taskExtract, respectively.)

Package league/url is abandoned, you should avoid using it. Use league/uri instead.

Generating autoload files