ExpressionEngine is a feature-rich, mature, flexible, secure, free and open-source content management system (CMS) with lots of add-ons that extend its capabilities. CMS is written in PHP programming language. Its source code is hosted on Github. With ExpressionEngine, you can build full-featured websites, create a web app, or serve content to mobile applications. All without requiring complex programming skills. This guide will walk you through the ExpressionEngine installation process on a fresh CentOS 8  using PHP, MariaDB, and Nginx.

Requirements

ExpressionEngine requires a web server running PHP and MySQL/MariaDB. The recommend software stack and versions are:

  • PHP version 7.0 or greater, running with PHP-FPM and with the following PHP extensions (gd, fileinfo, intl, mbstring).
  • MySQL version 5.6 or greater or Percona version 5.6 or greater. This guide will use MariaDB.
  • A web server like Nginx or Apache. This guide will use Nginx.

Before you begin

Check the CentOS version.

cat /etc/centos-release
# CentOS Linux release 8.1.1911 (Core)

Add a new non-root user account with sudo access and switch to it.

useradd -c "John Doe" johndoe && passwd johndoe
usermod -aG wheel johndoe
su - johndoe

NOTE: Replace johndoe with your username and make sure you are using a strong password to comply with the CentOS password policy.

Set up the system’s timezone.

timedatectl list-timezones
sudo timedatectl set-timezone 'Region/City'

Ensure that your system is up to date.

sudo dnf update

Install the needed packages.

sudo dnf install -y socat git wget unzip

For simplicity, disable SELinux and Firewall.

sudo setenforce 0 ; sudo systemctl stop firewalld ; sudo systemctl disable firewalld

Install PHP

Install PHP, as well as the necessary PHP extensions.

sudo dnf install -y php-cli php-fpm php-common php-mbstring php-gd php-intl php-mysqlnd php-json php-zip

Check the version.

php --version

# PHP 7.2.11 (cli) (built: Oct  9 2018 15:09:36) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

Start and enable PHP-FPM.

sudo systemctl start php-fpm
sudo systemctl enable php-fpm

Install MariaDB

Install MariaDB.

sudo dnf install -y mariadb-server

Check the version.

mysql --version
# mysql  Ver 15.1 Distrib 10.3.17-MariaDB, for Linux (x86_64) using readline 5.1

Start and enable MariaDB.

sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

Run the mysql_secure_installation script to improve the security of your MariaDB installation by answering the below questions.

sudo mysql_secure_installation
# 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]
# Reload privilege tables now? [Y/n] Y

Log into MariaDB as the root user.

sudo mysql -u root -p
# Enter password:

Create a new MariaDB database and database user for ExpressionEngine CMS, and remember the credentials. You will need to enter these details later in the installation process.

MariaDB> CREATE DATABASE dbname;
MariaDB> GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';
MariaDB> FLUSH PRIVILEGES;
MariaDB> quit

NOTE: Replace dbname and username with appropriate names for your setup. Replace password with a strong password.

Install Nginx

Install Nginx.

sudo dnf install -y nginx

Check the version.

nginx -v
# nginx version: nginx/1.14.1

Start and enable Nginx.

sudo systemctl start nginx
sudo systemctl enable nginx

Configure Nginx for ExpressionEngine.

Run sudo vim /etc/nginx/conf.d/expressionengine.conf and populate the file with the following configuration.

server {

  listen [::]:80;
  listen 80;
  
  server_name example.com;
  root /var/www/expressionengine;
  
  index index.php;
  
  location / {
    index index.php;
    try_files $uri $uri/ @ee;
  }
  
  location @ee {
    rewrite ^(.*) /index.php?$1 last;
  }
  
  location ~* \.php$ {
    fastcgi_pass unix:/run/php-fpm/www.sock;
    include fastcgi_params;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  }

}

Save the file and exit.

Test the configuration.

sudo nginx -t

Reload Nginx.

sudo systemctl reload nginx.service

Install ExpressionEngine

Create a document root directory.

sudo mkdir -p /var/www/expressionengine

Change ownership of the /var/www/expressionengine directory to johndoe.

sudo chown -R johndoe:johndoe /var/www/expressionengine

Navigate to the document root folder.

cd /var/www/expressionengine

Download the latest release of ExpressionEngine, unzip the files to a folder on your server and remove the archive.

wget -O expressionengine.zip --referer https://expressionengine.com/ 'https://expressionengine.com/?ACT=243'
unzip expressionengine.zip
rm expressionengine.zip

Change ownership of the /var/www/expressionengine directory to nginx.

sudo chown -R nginx:nginx /var/www/expressionengine

Run sudo vim /etc/php-fpm.d/www.conf

sudo vi /etc/php-fpm.d/www.conf

Set the user and group to nginx. Initially, they are set to apache.

user = nginx
group = nginx

Restart the PHP-FPM.

sudo systemctl restart php-fpm

Point your browser to the URL of the admin.php file you uploaded. For example: http://example.com/admin.php. Follow the on-screen instructions to install ExpressionEngine. Once the Installation Wizard is finished, rename or remove the system/ee/installer/ directory from your server.

Insert screenshot here