ExpressionEngine is a flexible, feature-rich, free, open-source content management system (CMS) written in PHP. 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 Ubuntu 18.04 LTS using PHP, MySQL as a database, and Nginx as a web server.

Requirements

ExpressionEngine requires a web server running PHP and MySQL. The recommended 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 tutorial will use MySQL.
  • A web server like Nginx or Apache. This guide will use Nginx.
  • An operating system running Ubuntu 18.04 LTS.
  • A non-root user with sudo privileges.

Initial steps

Check your Ubuntu version:

lsb_release -ds
# Ubuntu 18.04.2 LTS

Set up the timezone:

sudo dpkg-reconfigure tzdata

Update your operating system packages (software). This is an important first step because it ensures you have the latest updates and security fixes for your operating system’s default software packages:

sudo apt update && sudo apt upgrade -y

Install some essential packages that are necessary for basic administration of Ubuntu operating system:

sudo apt install -y curl wget vim git unzip socat bash-completion

Step 1 – Install PHP and required PHP extensions

Install PHP, as well as the necessary PHP extensions:

sudo apt install -y php7.2 php7.2-cli php7.2-fpm php7.2-common php7.2-mbstring php7.2-gd php7.2-intl php7.2-mysql

To show PHP compiled in modules, you can run:

php -m

ctype


curl


exif


fileinfo


. . .


. . .

Check the PHP version:

php --version
# PHP 7.2.19-0ubuntu0.18.04.2 (cli) (built: Aug 12 2019 19:34:28) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
# with Zend OPcache v7.2.19-0ubuntu0.18.04.2, Copyright (c) 1999-2018, by Zend Technologies

PHP-FPM service is automatically started and enabled on reboot on Ubuntu 18.04 system, so there is no need to start and enable it manually. We can move on to the next step, which is the database installation and setup.

Step 2 – Install MySQL and create a database for ExpressionEngine CMS

Install MySQL database server:

sudo apt install -y mysql-server

Check MySQL version:

mysql --version
# mysql  Ver 14.14 Distrib 5.7.27, for Linux (x86_64) using  EditLine wrapper

Run mysql_secure installation script to improve MySQL security and set the password for MySQL root user:

sudo mysql_secure_installation

Answer each of the questions:

Would you like to setup VALIDATE PASSWORD plugin? N
New password: your_secure_password
Re-enter new password: your_secure_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

Connect to MySQL shell as the root user:

sudo mysql -u root -p
# Enter password

Create an empty MySQL database and user for ExpressionEngine and remember the credentials:

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

Exit from MySQL:

mysql> exit

Replace dbname, username and password with your names.

Step 3 – Install acme.sh client and obtain Let’s Encrypt certificate (optional)

Securing your website with HTTPS is not necessary, but it is a good practice to secure your site traffic. To obtain a TLS certificate from Let’s Encrypt we will use acme.sh client. Acme.sh is a pure UNIX shell software for obtaining TLS certificates from Let’s Encrypt with zero dependencies.

Download and install acme.sh:

sudo su - root
git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh 
./acme.sh --install --accountemail [email protected]
source ~/.bashrc
cd ~

Check acme.sh version:

acme.sh --version
# v2.8.1

Obtain RSA and ECC/ECDSA certificates for your domain/hostname:

# RSA 2048
acme.sh --issue --standalone -d example.com --keylength 2048
# ECDSA
acme.sh --issue --standalone -d example.com --keylength ec-256

If you want fake certificates for testing you can add the --staging flag to the above commands.

After running the above commands, your certificates and keys will be in:

  • For RSA: /home/username/example.com directory.
  • For ECC/ECDSA: /home/username/example.com_ecc directory.

To list your issued certs you can run:

acme.sh --list

Create a directory to store your certs. We will use the /etc/letsencrypt directory.

mkdir -p /etc/letsecnrypt/example.com
sudo mkdir -p /etc/letsencrypt/example.com_ecc

Install/copy certificates to /etc/letsencrypt directory.

# RSA
acme.sh --install-cert -d example.com --cert-file /etc/letsencrypt/example.com/cert.pem --key-file /etc/letsencrypt/example.com/private.key --fullchain-file /etc/letsencrypt/example.com/fullchain.pem --reloadcmd "sudo systemctl reload nginx.service"
# ECC/ECDSA
acme.sh --install-cert -d example.com --ecc --cert-file /etc/letsencrypt/example.com_ecc/cert.pem --key-file /etc/letsencrypt/example.com_ecc/private.key --fullchain-file /etc/letsencrypt/example.com_ecc/fullchain.pem --reloadcmd "sudo systemctl reload nginx.service"

All the certificates will be automatically renewed every 60 days.

After obtaining certs exit form the root user and return to normal sudo user:

exit

Step 4 – Install and configure Nginx

Install the NGINX web server:

sudo apt install -y nginx

Check the NGINX version:

sudo nginx -v
# nginx version: nginx/1.14.0 (Ubuntu)

Configure Nginx for ExpressionEngine. Run sudo vim /etc/nginx/sites-available/expressionengine.conf and add the following configuration:

server {
  
  listen [::]:443 ssl http2; 
  listen 443 ssl http2;
  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/php7.2-fpm.sock;
    include fastcgi_params;
    fastcgi_index index.php5;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  }

}

Activate the new expressionengine.conf configuration by linking the file to the sites-enabled directory:

sudo ln -s /etc/nginx/sites-available/expressionengine.conf /etc/nginx/sites-enabled/

Check NGINX configuration for syntax errors:

sudo nginx -t

And finally, reload NGINX service for changes to take effect:

sudo systemctl reload nginx.service

Step 5 – Install ExpressionEngine CMS

Create a document root directory:

sudo mkdir -p /var/www/expressionengine

Navigate to the document root folder:

cd /var/www/expressionengine

Download the latest release of ExpressionEngine and unzip the files to a folder on your server:

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

Change ownership of the /var/www/expressionengine directory to www-data:

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

Point your browser to /admin.php file you uploaded (for example: http://example.com/admin.php) and run the installation wizard. Follow the on-screen instructions to install ExpressionEngine. Once the Installation Wizard is finished, you should rename or remove the system/ee/installer/ directory from your server.

Step 6 – Complete the ExpressionEngine setup

Fill in the database and admin user details click the “install” button:

How to Install ExpressionEngine CMS with Nginx on Ubuntu linux ubuntu

After that, you will be redirected to the default login page. Enter your login details and click the “Log In” button:

How to Install ExpressionEngine CMS with Nginx on Ubuntu linux ubuntu

You will see the ExpressionEngine dashboard, like below:

How to Install ExpressionEngine CMS with Nginx on Ubuntu linux ubuntu

This is how the frontend might look like:

How to Install ExpressionEngine CMS with Nginx on Ubuntu linux ubuntu

ExpressionEngine CMS installation is now finished.

Links