Setting up a Drupal 7 web-server with a LEMP stack

There are many ways to set up a web-server. This recipe tells how to do it for an Ubuntu 18.04 Linux server running NGINX and using PHP 7.2 and the MariaDB Mysql database manager.

  1. Install NGINX
    sudo apt install nginx
  2. Install PHP
    sudo apt install php7.2
  3. Install PHP extensions (php7.2-fpm php7.2-common php7.2-curl php7.2-gd php7.2-imagick php7.2-mcrypt php7.2-memcache php7.2-xmlrpc php7.2-xsl php7.2-json php7.2-opcache php7.2-mbstring php7.2-xml php-pear libssh2-php php7.2-yaml):
    sudo apt install
  4. Install MariaDB
    sudo apt install mariadb-server
  5. Configure your server in NGINX
  6. Create a new database in MySQL
    echo "CREATE USER 'dbuser'@'localhost' IDENTIFIED BY 'dbpassword';" | mysql -urootname -prootpassword
    echo "CREATE DATABASE IF NOT EXISTS yad7db;" | mysql -urootname -prootpassword
    echo "GRANT ALL PRIVILEGES ON yad7db.* TO 'dbuser'@'localhost' IDENTIFIED BY 'dbpassword';" | mysql -urootname -prootpassword
  7. Access Drupal and initialize your site.