{"id":13873,"date":"2019-04-06T12:45:24","date_gmt":"2019-04-06T12:45:24","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=13873"},"modified":"2019-04-06T12:45:24","modified_gmt":"2019-04-06T12:45:24","slug":"how-to-install-nginx-mariadb-10-php-7-lemp-stack-in-16-10-16-04","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/06\/how-to-install-nginx-mariadb-10-php-7-lemp-stack-in-16-10-16-04\/","title":{"rendered":"How To Install Nginx, MariaDB 10, PHP 7 (LEMP Stack) in 16.10\/16.04"},"content":{"rendered":"<p>The\u00a0<strong>LEMP<\/strong>\u00a0stack is an acronym which represents is a group of packages (Linux OS, Nginx web server, MySQL\\MariaDB database and PHP server-side dynamic programming language) which are used to deploy dynamic web applications and web pages.<\/p>\n<p>This tutorial will guide you on how to install a LEMP stack with\u00a0<strong>MariaDB 10<\/strong>,\u00a0<strong>PHP 7<\/strong>\u00a0and\u00a0<strong>HTTP 2.0<\/strong>\u00a0Support for\u00a0<strong>Nginx<\/strong>\u00a0on\u00a0<strong>Ubuntu 16.10<\/strong>\u00a0and\u00a0<strong>Ubuntu 16.04<\/strong>\u00a0server\/desktop editions.<\/p>\n<h4>Requirements<\/h4>\n<ol>\n<li><a href=\"https:\/\/www.tecmint.com\/installation-of-ubuntu-16-04-server-edition\/\" target=\"_blank\" rel=\"noopener\">Installation of Ubuntu 16.04 Server Edition<\/a>\u00a0[instructions also works on\u00a0<strong>Ubuntu 16.10<\/strong>]<\/li>\n<\/ol>\n<h3>Step 1: Install the Nginx Web Server<\/h3>\n<p><strong>1.<\/strong>\u00a0Nginx is a modern and resources efficient web server used to display web pages to visitors on the internet. We\u2019ll start by installing Nginx web server from Ubuntu official repositories by using the\u00a0<a href=\"https:\/\/www.tecmint.com\/apt-advanced-package-command-examples-in-ubuntu\/\" target=\"_blank\" rel=\"noopener\">apt command line<\/a>.<\/p>\n<pre>$ sudo apt-get install nginx\r\n<\/pre>\n<div id=\"attachment_20750\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Install-Nginx-on-Ubuntu-16.04.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20750\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Install-Nginx-on-Ubuntu-16.04.png\" sizes=\"auto, (max-width: 860px) 100vw, 860px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Install-Nginx-on-Ubuntu-16.04.png 860w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Install-Nginx-on-Ubuntu-16.04-768x447.png 768w\" alt=\"Install Nginx on Ubuntu 16.04\" width=\"860\" height=\"500\" aria-describedby=\"caption-attachment-20750\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-20750\" class=\"wp-caption-text\">Install Nginx on Ubuntu 16.04<\/p>\n<\/div>\n<p><strong>2.<\/strong>\u00a0Next, issue the\u00a0<a href=\"https:\/\/www.tecmint.com\/20-netstat-commands-for-linux-network-management\/\" target=\"_blank\" rel=\"noopener\">netstat<\/a>\u00a0and\u00a0<a href=\"https:\/\/www.tecmint.com\/manage-services-using-systemd-and-systemctl-in-linux\/\" target=\"_blank\" rel=\"noopener\">systemctl<\/a>\u00a0commands in order to confirm if\u00a0<strong>Nginx<\/strong>\u00a0is started and binds on port\u00a0<strong>80<\/strong>.<\/p>\n<pre>$ netstat -tlpn\r\n<\/pre>\n<div id=\"attachment_20751\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Check-Nginx-Network-Port-Connection.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20751\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Check-Nginx-Network-Port-Connection.png\" sizes=\"auto, (max-width: 848px) 100vw, 848px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Check-Nginx-Network-Port-Connection.png 848w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Check-Nginx-Network-Port-Connection-768x248.png 768w\" alt=\"Check Nginx Network Port Connection\" width=\"848\" height=\"274\" aria-describedby=\"caption-attachment-20751\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-20751\" class=\"wp-caption-text\">Check Nginx Network Port Connection<\/p>\n<\/div>\n<pre>$ sudo systemctl status nginx.service\r\n<\/pre>\n<div id=\"attachment_20752\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Check-Nginx-Service-Status.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20752\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Check-Nginx-Service-Status.png\" sizes=\"auto, (max-width: 855px) 100vw, 855px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Check-Nginx-Service-Status.png 855w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Check-Nginx-Service-Status-768x257.png 768w\" alt=\"Check Nginx Service Status\" width=\"855\" height=\"286\" aria-describedby=\"caption-attachment-20752\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-20752\" class=\"wp-caption-text\">Check Nginx Service Status<\/p>\n<\/div>\n<p>Once you have the confirmation that the server is started you can open a browser and navigate to your server IP address or DNS record using HTTP protocol in order to visit Nginx default web page.<\/p>\n<pre>http:\/\/IP-Address\r\n<\/pre>\n<div id=\"attachment_20753\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Verify-Nginx-Webpage.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20753\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Verify-Nginx-Webpage.png\" alt=\"Verify Nginx Webpage\" width=\"588\" height=\"288\" aria-describedby=\"caption-attachment-20753\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-20753\" class=\"wp-caption-text\">Verify Nginx Webpage<\/p>\n<\/div>\n<h3>Step 2: Enable Nginx HTTP\/2.0 Protocol<\/h3>\n<p><strong>3.<\/strong>\u00a0The\u00a0<strong>HTTP\/2.0<\/strong>\u00a0protocol which is build by default in the latest release of Nginx binaries on\u00a0<strong>Ubuntu 16.04<\/strong>\u00a0works only in conjunction with SSL and promises a huge speed improvement in loading web SSL web pages.<\/p>\n<p>To enable the protocol in Nginx on\u00a0<strong>Ubuntu 16.04<\/strong>, first navigate to Nginx available sites configuration files and backup the default configuration file by issuing the below command.<\/p>\n<pre>$ cd \/etc\/nginx\/sites-available\/\r\n$ sudo mv default default.backup\r\n<\/pre>\n<div id=\"attachment_20754\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Backup-Nginx-Sites-Configuration-File.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20754\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Backup-Nginx-Sites-Configuration-File.png\" alt=\"Backup Nginx Sites Configuration File\" width=\"628\" height=\"112\" aria-describedby=\"caption-attachment-20754\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-20754\" class=\"wp-caption-text\">Backup Nginx Sites Configuration File<\/p>\n<\/div>\n<p><strong>4.<\/strong>\u00a0Then, using a text editor create a new default page with the below instructions:<\/p>\n<pre>server {\r\n        listen 443 ssl http2 default_server;\r\n        listen [::]:443 ssl http2 default_server;\r\n\r\n        root \/var\/www\/html;\r\n\r\n        index index.html index.htm index.php;\r\n\r\n        server_name 192.168.1.13;\r\n\r\n        location \/ {\r\n                try_files $uri $uri\/ =404;\r\n        }\r\n\r\n        ssl_certificate \/etc\/nginx\/ssl\/nginx.crt;\r\n        ssl_certificate_key \/etc\/nginx\/ssl\/nginx.key;\r\n\r\n        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;\r\n        ssl_prefer_server_ciphers on;\r\n        ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;\r\n        ssl_dhparam  \/etc\/nginx\/ssl\/dhparam.pem;\r\n        ssl_session_cache shared:SSL:20m;\r\n        ssl_session_timeout 180m;\r\n        resolver 8.8.8.8 8.8.4.4;\r\n        add_header Strict-Transport-Security \"max-age=31536000;\r\n        #includeSubDomains\" always;\r\n\r\n\r\n        location ~ \\.php$ {\r\n                include snippets\/fastcgi-php.conf;\r\n                fastcgi_pass unix:\/run\/php\/php7.0-fpm.sock;\r\n        }\r\n\r\n        location ~ \/\\.ht {\r\n                deny all;\r\n        }\r\n\r\n}\r\n\r\nserver {\r\n       listen         80;\r\n       listen    [::]:80;\r\n       server_name    192.168.1.13;\r\n       return         301 https:\/\/$server_name$request_uri;\r\n}\r\n<\/pre>\n<div id=\"attachment_20755\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Enable-Nginx-HTTP-2-Protocol.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20755\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Enable-Nginx-HTTP-2-Protocol.png\" sizes=\"auto, (max-width: 901px) 100vw, 901px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Enable-Nginx-HTTP-2-Protocol.png 901w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Enable-Nginx-HTTP-2-Protocol-768x739.png 768w\" alt=\"Enable Nginx HTTP 2 Protocol\" width=\"901\" height=\"867\" aria-describedby=\"caption-attachment-20755\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-20755\" class=\"wp-caption-text\">Enable Nginx HTTP 2 Protocol<\/p>\n<\/div>\n<p>The above configuration snippet enables the use of\u00a0<strong>HTTP\/2.0<\/strong>\u00a0by adding the\u00a0<code>http2<\/code>\u00a0parameter to all SSL listen directives.<\/p>\n<p>Also, the last part of the excerpt enclosed in server directive is used to redirect all non-SSL traffic to SSL\/TLS default host. Also, replace the\u00a0<code>server_name<\/code>\u00a0directive to match your own IP address or DNS record (FQDN preferably).<\/p>\n<p><strong>5.<\/strong>\u00a0Once you finished editing Nginx default configuration file with the above settings, generate and list the SSL certificate file and key by executing the below commands.<\/p>\n<p>Fill the certificate with your own custom settings and pay attention to\u00a0<strong>Common Name<\/strong>\u00a0setting to match your DNS FQDN record or your server IP address that will be used to access the web page.<\/p>\n<pre>$ sudo mkdir \/etc\/nginx\/ssl\r\n$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout \/etc\/nginx\/ssl\/nginx.key -out \/etc\/nginx\/ssl\/nginx.crt\r\n$ ls \/etc\/nginx\/ssl\/\r\n<\/pre>\n<div id=\"attachment_20756\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Generate-SSL-Certificate-and-Key.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20756\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Generate-SSL-Certificate-and-Key.png\" sizes=\"auto, (max-width: 927px) 100vw, 927px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Generate-SSL-Certificate-and-Key.png 927w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Generate-SSL-Certificate-and-Key-768x488.png 768w\" alt=\"Generate SSL Certificate and Key for Nginx\" width=\"927\" height=\"589\" aria-describedby=\"caption-attachment-20756\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-20756\" class=\"wp-caption-text\">Generate SSL Certificate and Key for Nginx<\/p>\n<\/div>\n<p><strong>6.<\/strong>\u00a0Also, create a strong\u00a0<strong>DH cypher<\/strong>, which was changed on the above configuration file on\u00a0<code>ssl_dhparam<\/code>instruction line, by issuing the below command:<\/p>\n<pre>$ sudo openssl dhparam -out \/etc\/nginx\/ssl\/dhparam.pem 2048\r\n<\/pre>\n<div id=\"attachment_20757\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Create-Diffie-Hellman-Key.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20757\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Create-Diffie-Hellman-Key.png\" sizes=\"auto, (max-width: 920px) 100vw, 920px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Create-Diffie-Hellman-Key.png 920w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Create-Diffie-Hellman-Key-768x552.png 768w\" alt=\"Create Diffie-Hellman Key\" width=\"920\" height=\"661\" aria-describedby=\"caption-attachment-20757\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-20757\" class=\"wp-caption-text\">Create Diffie-Hellman Key<\/p>\n<\/div>\n<p><strong>7.<\/strong>\u00a0Once the\u00a0<strong>Diffie-Hellman<\/strong>\u00a0key has been created, verify if Nginx configuration file is correctly written and can be applied by Nginx web server and restart the daemon to reflect changes by running the below commands.<\/p>\n<pre>$ sudo nginx -t\r\n$ sudo systemctl restart nginx.service\r\n<\/pre>\n<div id=\"attachment_20758\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Check-Nginx-Configuration.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20758\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Check-Nginx-Configuration.png\" alt=\"Check Nginx Configuration\" width=\"682\" height=\"172\" aria-describedby=\"caption-attachment-20758\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-20758\" class=\"wp-caption-text\">Check Nginx Configuration<\/p>\n<\/div>\n<p><strong>8.<\/strong>\u00a0In order to test if Nginx uses\u00a0<strong>HTTP\/2.0<\/strong>\u00a0protocol issue the below command. The presence of\u00a0<code>h2<\/code>\u00a0advertised protocol confirms that Nginx has been successfully configured to use HTTP\/2.0 protocol. All modern up-to-date browsers should support this protocol by default.<\/p>\n<pre>$ openssl s_client -connect localhost:443 -nextprotoneg ''\r\n<\/pre>\n<div id=\"attachment_20759\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Test-Nginx-HTTP-2-Protocol.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20759\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Test-Nginx-HTTP-2-Protocol.png\" sizes=\"auto, (max-width: 794px) 100vw, 794px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Test-Nginx-HTTP-2-Protocol.png 794w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Test-Nginx-HTTP-2-Protocol-768x592.png 768w\" alt=\"Test Nginx HTTP 2.0 Protocol\" width=\"794\" height=\"612\" aria-describedby=\"caption-attachment-20759\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-20759\" class=\"wp-caption-text\">Test Nginx HTTP 2.0 Protocol<\/p>\n<\/div>\n<h3>Step 3: Install PHP 7 Interpreter<\/h3>\n<p>Nginx can be used with PHP dynamic processing language interpreter to generate dynamic web content with the help of FastCGI process manager obtained by installing the\u00a0<strong>php-fpm<\/strong>\u00a0binary package from Ubuntu official repositories.<\/p>\n<p><strong>9.<\/strong>\u00a0In order to grab\u00a0<strong>PHP7.0<\/strong>\u00a0and the additional packages that will allow PHP to communicate with Nginx web server issue the below command on your server console:<\/p>\n<pre>$ sudo apt install php7.0 php7.0-fpm \r\n<\/pre>\n<div id=\"attachment_20760\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Install-PHP-7-PHP-FPM-for-Ngin.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20760\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Install-PHP-7-PHP-FPM-for-Ngin.png\" sizes=\"auto, (max-width: 844px) 100vw, 844px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Install-PHP-7-PHP-FPM-for-Ngin.png 844w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Install-PHP-7-PHP-FPM-for-Ngin-768x354.png 768w\" alt=\"Install PHP 7 and PHP-FPM for Ngin\" width=\"844\" height=\"389\" aria-describedby=\"caption-attachment-20760\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-20760\" class=\"wp-caption-text\">Install PHP 7 and PHP-FPM for Ngin<\/p>\n<\/div>\n<p><strong>10.<\/strong>\u00a0Once the\u00a0<strong>PHP7.0<\/strong>\u00a0interpreter has been successfully installed on your machine, start and check\u00a0<strong>php7.0-fpm<\/strong>daemon by issuing the below command:<\/p>\n<pre>$ sudo systemctl start php7.0-fpm\r\n$ sudo systemctl status php7.0-fpm\r\n<\/pre>\n<div id=\"attachment_20761\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Start-Verify-php-fpm-Service.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20761\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Start-Verify-php-fpm-Service.png\" sizes=\"auto, (max-width: 812px) 100vw, 812px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Start-Verify-php-fpm-Service.png 812w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Start-Verify-php-fpm-Service-768x370.png 768w\" alt=\"Start and Verify php-fpm Service\" width=\"812\" height=\"391\" aria-describedby=\"caption-attachment-20761\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-20761\" class=\"wp-caption-text\">Start and Verify php-fpm Service<\/p>\n<\/div>\n<p><strong>11.<\/strong>\u00a0The current configuration file of Nginx is already configured to use\u00a0<strong>PHP FastCGI<\/strong>\u00a0process manager in order to server dynamic content.<\/p>\n<p>The server block that enables Nginx to use PHP interpreter is presented on the below excerpt, so no further modifications of default Nginx configuration file are required.<\/p>\n<pre>location ~ \\.php$ {\r\n                include snippets\/fastcgi-php.conf;\r\n                fastcgi_pass unix:\/run\/php\/php7.0-fpm.sock;\r\n        }\r\n<\/pre>\n<p>Below is a screenshot of what instructions you need to uncomment and modify is case of an original Nginx default configuration file.<\/p>\n<div id=\"attachment_20762\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Enable-PHP-FastCGI-for-Nginx.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20762\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Enable-PHP-FastCGI-for-Nginx.png\" sizes=\"auto, (max-width: 837px) 100vw, 837px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Enable-PHP-FastCGI-for-Nginx.png 837w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Enable-PHP-FastCGI-for-Nginx-768x837.png 768w\" alt=\"Enable PHP FastCGI for Nginx\" width=\"837\" height=\"912\" aria-describedby=\"caption-attachment-20762\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-20762\" class=\"wp-caption-text\">Enable PHP FastCGI for Nginx<\/p>\n<\/div>\n<p><strong>12.<\/strong>\u00a0To test Nginx web server relation with PHP FastCGI process manager create a PHP\u00a0<code>info.php<\/code>\u00a0test configuration file by issuing the below command and verify the settings by visiting this configuration file using the below address:\u00a0<code>http:\/\/IP_or domain\/info.php<\/code>.<\/p>\n<pre>$ sudo su -c 'echo \"&lt;?php phpinfo(); ?&gt;\" |tee \/var\/www\/html\/info.php'\r\n<\/pre>\n<div id=\"attachment_20763\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Create-PHP-Info-File.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20763\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Create-PHP-Info-File.png\" alt=\"Create PHP Info File\" width=\"725\" height=\"133\" aria-describedby=\"caption-attachment-20763\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-20763\" class=\"wp-caption-text\">Create PHP Info File<\/p>\n<\/div>\n<div id=\"attachment_20764\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Verify-PHP-FastCGI-Info.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20764\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Verify-PHP-FastCGI-Info.png\" sizes=\"auto, (max-width: 1012px) 100vw, 1012px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Verify-PHP-FastCGI-Info.png 1012w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Verify-PHP-FastCGI-Info-768x560.png 768w\" alt=\"Verify PHP FastCGI Info\" width=\"1012\" height=\"738\" aria-describedby=\"caption-attachment-20764\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-20764\" class=\"wp-caption-text\">Verify PHP FastCGI Info<\/p>\n<\/div>\n<p>Also check if\u00a0<strong>HTTP\/2.0<\/strong>\u00a0protocol is advertised by the server by locating the line\u00a0<code>$_SERVER[\u2018SERVER_PROTOCOL\u2019]<\/code>\u00a0on PHP Variables block as illustrated on the below screenshot.<\/p>\n<div id=\"attachment_20765\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Check-HTTP-2.0-Protocol-Info.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20765\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Check-HTTP-2.0-Protocol-Info.png\" sizes=\"auto, (max-width: 1045px) 100vw, 1045px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Check-HTTP-2.0-Protocol-Info.png 1045w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Check-HTTP-2.0-Protocol-Info-768x538.png 768w\" alt=\"Check HTTP 2.0 Protocol Info\" width=\"1045\" height=\"732\" aria-describedby=\"caption-attachment-20765\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-20765\" class=\"wp-caption-text\">Check HTTP 2.0 Protocol Info<\/p>\n<\/div>\n<p><strong>13.<\/strong>\u00a0In order to install extra\u00a0<strong>PHP7.0<\/strong>\u00a0modules use the\u00a0<code>apt search php7.0<\/code>\u00a0command to find a PHP module and install it.<\/p>\n<p>Also, try to install the following PHP modules which can come in handy in case you are planning to\u00a0<a href=\"https:\/\/www.tecmint.com\/install-wordpress-using-lamp-or-lemp-on-rhel-centos-fedora\/\" target=\"_blank\" rel=\"noopener\">install WordPress<\/a>\u00a0or other CMS.<\/p>\n<pre>$ sudo apt install php7.0-mcrypt php7.0-mbstring\r\n<\/pre>\n<div id=\"attachment_20766\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Install-PHP-7-Modules.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20766\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Install-PHP-7-Modules.png\" alt=\"Install PHP 7 Modules\" width=\"705\" height=\"284\" aria-describedby=\"caption-attachment-20766\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-20766\" class=\"wp-caption-text\">Install PHP 7 Modules<\/p>\n<\/div>\n<p><strong>14.<\/strong>\u00a0To register the PHP extra modules just restart\u00a0<strong>PHP-FPM<\/strong>\u00a0daemon by issuing the below command.<\/p>\n<pre>$ sudo systemctl restart php7.0-fpm.service\r\n<\/pre>\n<h3>Step 4: Install MariaDB Database<\/h3>\n<p><strong>15.<\/strong>\u00a0Finally, in order to complete our\u00a0<strong>LEMP<\/strong>\u00a0stack we need the MariaDB database component to store and manage website data.<\/p>\n<p>Install\u00a0<strong>MariaDB<\/strong>\u00a0database management system by running the below command and restart\u00a0<strong>PHP-FPM<\/strong>\u00a0service in order to use MySQL module to access the database.<\/p>\n<pre>$ sudo apt install mariadb-server mariadb-client php7.0-mysql\r\n$ sudo systemctl restart php7.0-fpm.service\r\n<\/pre>\n<div id=\"attachment_20767\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Install-MariaDB-for-Nginx.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20767\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Install-MariaDB-for-Nginx.png\" sizes=\"auto, (max-width: 856px) 100vw, 856px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Install-MariaDB-for-Nginx.png 856w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Install-MariaDB-for-Nginx-768x397.png 768w\" alt=\"Install MariaDB for Nginx\" width=\"856\" height=\"442\" aria-describedby=\"caption-attachment-20767\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-20767\" class=\"wp-caption-text\">Install MariaDB for Nginx<\/p>\n<\/div>\n<p><strong>16.<\/strong>\u00a0To secure the MariaDB installation, run the security script provided by the binary package from Ubuntu repositories which will ask you set a root password, remove anonymous users, disable root login remotely and remove test database.<\/p>\n<p>Run the script by issuing the below command and answer all questions with\u00a0<code>yes<\/code>. Use the below screenshot as a guide.<\/p>\n<pre>$ sudo mysql_secure_installation\r\n<\/pre>\n<div id=\"attachment_20768\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Secure-MariaDB-Installation-for-Nginx.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20768\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Secure-MariaDB-Installation-for-Nginx.png\" alt=\"Secure MariaDB Installation for Nginx\" width=\"717\" height=\"997\" aria-describedby=\"caption-attachment-20768\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-20768\" class=\"wp-caption-text\">Secure MariaDB Installation for Nginx<\/p>\n<\/div>\n<p><strong>17.<\/strong>\u00a0To configure MariaDB so that ordinary users can access the database without system\u00a0<strong>sudo<\/strong>\u00a0privileges, go to MySQL command line interface with root privileges and run the below commands on MySQL interpreter:<\/p>\n<pre>$ sudo mysql \r\nMariaDB&gt; use mysql;\r\nMariaDB&gt; update user set plugin=\u2019\u2018 where User=\u2019root\u2019;\r\nMariaDB&gt; flush privileges;\r\nMariaDB&gt; exit\r\n<\/pre>\n<div id=\"attachment_20769\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/MariaDB-User-Permissions.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20769\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/MariaDB-User-Permissions.png\" alt=\"MariaDB User Permissions\" width=\"724\" height=\"465\" aria-describedby=\"caption-attachment-20769\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-20769\" class=\"wp-caption-text\">MariaDB User Permissions<\/p>\n<\/div>\n<p>Finally, login to MariaDB database and run an arbitrary command without root privileges by executing the below command:<\/p>\n<pre>$ mysql -u root -p -e 'show databases'\r\n<\/pre>\n<div id=\"attachment_20770\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Check-MariaDB-Databases.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20770\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/05\/Check-MariaDB-Databases.png\" alt=\"Check MariaDB Databases\" width=\"570\" height=\"203\" aria-describedby=\"caption-attachment-20770\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-20770\" class=\"wp-caption-text\">Check MariaDB Databases<\/p>\n<\/div>\n<p>That\u2019 all! Now you have a\u00a0<strong>LEMP<\/strong>\u00a0stack configured on\u00a0<strong>Ubuntu 16.10<\/strong>\u00a0and\u00a0<strong>Ubuntu 16.04<\/strong>\u00a0server that allows you to deploy complex dynamic web applications that can interact with databases.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/install-nginx-mysql-php-lemp-in-ubuntu-16-10-ubuntu-16-04\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The\u00a0LEMP\u00a0stack is an acronym which represents is a group of packages (Linux OS, Nginx web server, MySQL\\MariaDB database and PHP server-side dynamic programming language) which are used to deploy dynamic web applications and web pages. This tutorial will guide you on how to install a LEMP stack with\u00a0MariaDB 10,\u00a0PHP 7\u00a0and\u00a0HTTP 2.0\u00a0Support for\u00a0Nginx\u00a0on\u00a0Ubuntu 16.10\u00a0and\u00a0Ubuntu 16.04\u00a0server\/desktop editions. &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/06\/how-to-install-nginx-mariadb-10-php-7-lemp-stack-in-16-10-16-04\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How To Install Nginx, MariaDB 10, PHP 7 (LEMP Stack) in 16.10\/16.04&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-13873","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13873","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=13873"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13873\/revisions"}],"predecessor-version":[{"id":13874,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13873\/revisions\/13874"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=13873"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=13873"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=13873"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}