ExpressionEngine is a mature, flexible, secure and free open-source content management system (CMS) written in PHP. 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 Ubuntu 18.04 LTS Rcs instance using PHP, MySQL as a database, and Nginx as a web server.
Requirements
ExpressionEngine requires a web server running PHP and MySQL. The recommend software stack and versions are:
- PHP version 7.0 or greater, running with PHP-FPM and with the following PHP extensions:
gdfileinfointlmbstring- 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.
Before you begin
Check the Ubuntu version.
lsb_release -ds
# Ubuntu 18.04.2 LTSCreate a new non-root user account with sudo access and switch to it.
adduser johndoe --gecos "John Doe"
usermod -aG sudo johndoe
su - johndoeNOTE: Replace johndoe with your username.
Set up the timezone.
sudo dpkg-reconfigure tzdataEnsure that your system is up to date.
sudo apt update && sudo apt upgrade -yInstall needed packages.
sudo apt install -y zip unzip curl wget gitInstall PHP
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-mysqlCheck the version.
php --version
# PHP 7.2.19-0ubuntu0.18.04.1 (cli) (built: Jun 4 2019 14:48:12) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
# with Zend OPcache v7.2.10-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend TechnologiesInstall MySQL
Install MySQL.
sudo apt install -y mysql-serverCheck the version.
mysql --version
# mysql Ver 14.14 Distrib 5.7.26, for Linux (x86_64) using EditLine wrapperRun the mysql_secure_installation script to improve the security of your MySQL installation.
sudo mysql_secure_installationLog into MySQL as the root user.
sudo mysql -u root -p
# Enter password:Create a new MySQL database and database user, and remember the credentials.
mysql> CREATE DATABASE dbname;
mysql> GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;
mysql> quitNOTE: Replace dbname and username with appropriate names for your setup. Replace password with a strong password.
Install Nginx
Install Nginx.
sudo apt install -y nginxCheck the 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 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/php7.2-fpm.sock;
include fastcgi_params;
fastcgi_index index.php5;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}Save the file and exit with Colon+W+Q.
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/Test the configuration.
sudo nginx -tReload Nginx.
sudo systemctl reload nginx.serviceInstall ExpressionEngine
Create a document root directory.
sudo mkdir -p /var/www/expressionengineChange ownership of the /var/www/expressionengine directory to johndoe.
sudo chown -R johndoe:johndoe /var/www/expressionengineNavigate to the document root folder.
cd /var/www/expressionengineDownload the latest release of ExpressionEngine and unzip the files to a folder on your server.
wget -O ee.zip --referer https://expressionengine.com/ 'https://expressionengine.com/?ACT=243'
unzip ee.zip
rm ee.zipChange ownership of the /var/www/expressionengine directory to www-data.
sudo chown -R www-data:www-data /var/www/expressionenginePoint 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, you should rename or remove the system/ee/installer/ directory from your server.