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 20.04 Linux server running NGINX and using PHP 7.4 and the MariaDB Mysql database manager.

  1. Install NGINX
    sudo apt install nginx
  2. Install PHP (you may need to add an apt repository first (sudo add-apt-repository ppa:ondrej/php)
    sudo apt install php7.4
  3. Install PHP extensions (php7.4-fpm php7.4-common php7.4-curl php7.4-gd php7.4-imagick php7.4-mcrypt php7.4-memcache php7.4-xmlrpc php7.4-xsl php7.2-json php7.4-opcache php7.4-mbstring php7.4-xml php-pear php7.4-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.
4 / 2019