<\/span><\/h2>\nWe will be using a LEMP stack for our Microweber website, so the first step will be to install the Nginx web server.<\/p>\n
To install Nginx on your Debian 9 server, run the following command:<\/p>\n
sudo apt-get install nginx<\/pre>\nOnce the installation is complete, enable the Nginx service to start automatically upon system boot. You can do that with the following command:<\/p>\n
sudo systemctl enable nginx<\/pre>\nTo verify that Apache is running, execute the following command:<\/p>\n
sudo systemctl status nginx<\/pre>\nThe output should look something like this:<\/p>\n
\u25cf nginx.service - A high performance web server and a reverse proxy server\r\n Loaded: loaded (\/lib\/systemd\/system\/nginx.service; enabled; vendor preset: enabled)\r\n Active: active (running) since Wed 2019-05-01 04:23:11 EDT; 6s ago\r\n Docs: man:nginx(8)\r\n Process: 20249 ExecStart=\/usr\/sbin\/nginx -g daemon on; master_process on; (code=exited, status=0\/SUCCESS)\r\n Process: 20246 ExecStartPre=\/usr\/sbin\/nginx -t -q -g daemon on; master_process on; (code=exited, status=0\/SUCCESS)\r\n Main PID: 20250 (nginx)\r\n Tasks: 3 (limit: 4915)\r\n CGroup: \/system.slice\/nginx.service\r\n \u251c\u250020250 nginx: master process \/usr\/sbin\/nginx -g daemon on; master_process on;\r\n \u251c\u250020251 nginx: worker process\r\n \u2514\u250020252 nginx: worker process<\/pre>\nAlso, you can verify that Nginx is running by opening a web browser and visiting your server IP address (http:\/\/your-server-ip<\/span><\/strong>). You should get the Nginx welcome page. If everything shows up alright, then we can move onto the next step.<\/p>\n<\/span>Step 3: Install MariaDB<\/span><\/h2>\nThe next step is to install the MariaDB database server, an open-source variant of MySQL that is functionally identical.<\/p>\n
To install MariaDB on your system, type the following command and enter the character ‘Y’ when prompted:<\/p>\n
sudo apt-get install mariadb-server<\/pre>\nDuring the installation, you will be asked to enter a password for the MariaDB root user. Make sure to enter a strong password.<\/p>\n
To further improve the security of our MariaDB installation as well as set up a password for our MariaDB root user, we need to run the mysql_secure_installation<\/code><\/strong> script and follow the on-screen instructions. Run the command below to configure your system:<\/p>\nsudo mysql_secure_installation<\/pre>\nIf the program asks you to enter your current MariaDB root password, just press your [Enter] key once, as no password is set by default when installing MariaDB. If you however did set a password during install, just enter the password you entered earlier.<\/p>\n
A few more questions will be displayed on-screen – it is recommended that you answer yes to all of them by entering the character ‘Y’:<\/p>\n
Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y\r\n\r\nDisallow root login remotely? (Press y|Y for Yes, any other key for No) : Y\r\n\r\nRemove test database and access to it? (Press y|Y for Yes, any other key for No) : Y\r\n\r\nReload privilege tables now? (Press y|Y for Yes, any other key for No) : Y<\/pre>\nAgain, we can enable MariaDB to start on boot with the following command:<\/p>\n
sudo systemctl enable mariadb<\/pre>\nThat\u2019s it \u2013 MariaDB has been installed and made more secure.<\/p>\n
<\/span>Step 4: Install PHP 7.2<\/span><\/h2>\nThe last step of our LEMP stack setup is to install PHP. Debian 9 comes with PHP 7.0 by default, but we will show you how to install PHP 7.2 instead.<\/p>\n
We will also include some additional modules in order to help PHP to connect with our Nginx and MariaDB servers.\u00a0 Additionally, we will install modules that are required by our Microweber site.<\/p>\n
First, execute the following commands in order to enable the PPA and install the required packages which are required for the PHP 7.2 installation. Then, import the package signing key in order to configure a PPA for the PHP packages on your Debian 9 system.<\/p>\n
apt install apt-transport-https lsb-release ca-certificates\r\nwget -O \/etc\/apt\/trusted.gpg.d\/php.gpg https:\/\/packages.sury.org\/php\/apt.gpg\r\necho \"deb https:\/\/packages.sury.org\/php\/ $(lsb_release -sc) main\" > \/etc\/apt\/sources.list.d\/php.list\r\napt update<\/pre>\nWe can now install PHP 7.2 and all the required modules with just one line:<\/p>\n
sudo apt-get install php7.2 php7.2-fpm php7.2-common php7.2-mysql php7.2-cli php7.2-opcache php7.2-gd php7.2-curl php7.2-cli php7.2-imap php7.2-mbstring php7.2-soap 7.2-xmlrpc php7.2-xml php7.2-zip<\/pre>\nUse the next command to check the PHP version currently installed on your server:<\/p>\n
php -v<\/pre>\nYou should receive the following text as the output:<\/p>\n
PHP 7.2.17-1+0~20190412071344.20+stretch~1.gbp23a36d (cli) (built: Apr 12 2019 07:13:45) ( NTS )\r\nCopyright (c) 1997-2018 The PHP Group\r\nZend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies\r\nwith Zend OPcache v7.2.17-1+0~20190412071344.20+stretch~1.gbp23a36d, Copyright (c) 1999-2018, by Zend Technologies<\/pre>\n<\/span>Step 5: Install Microweber<\/span><\/h2>\nWe can now start with our Microweber installation and configuration.<\/p>\n
First, we need to create a new database. To do this, log in to your MariaDB database server as the root user by typing the following command:<\/p>\n
sudo mariadb -u root -p<\/pre>\nTo create a new database and user, run the following commands on the MariaDB shell:<\/p>\n
CREATE DATABASE microweber;\r\nCREATE USER microweber@localhost IDENTIFIED BY 'strong-password<\/span>';\r\nGRANT ALL PRIVILEGES ON microweber.* TO microweber@localhost;\r\nFLUSH PRIVILEGES;<\/pre>\nMake sure to replace\u00a0strong-password<\/span> with an actual strong password.<\/p>\nTo exit the MariaDB database server command line, type:<\/p>\n
exit<\/pre>\nNext,\u00a0let’s create a new directory for our Microweber site:<\/p>\n
sudo mkdir \/var\/www\/microweber<\/pre>\nWe can now download the latest Microweber version from the official site. You can do this with the following command:<\/p>\n
wget https:\/\/microweber.com\/download.php -O latest.zip<\/pre>\nTo extract the file in our Microweber directory, execute the following command:<\/p>\n
sudo unzip latest.zip -d \/var\/www\/microweber\/<\/pre>\nThe owner of the files needs to be the user of the web server running on your system. In our example, we are using the Nginx web server and Apache runs under the \u201cwww-data\u201d user on Debian 9.\u00a0 To change the owner of the files, you can then run the following command:<\/p>\n
sudo chown -R www-data:www-data \/var\/www\/microweber\/<\/pre>\n