In this tutorial, we will explain How to install LLMP Stack on Ubuntu

LLMP Stack is a popular open source web platform commonly used to run dynamic web sites and servers. It includes Linux, Lighttpd, MySQL, and PHP/Python/Perl and is considered by many the platform of choice for development and deployment of high-performance web applications which require a solid and reliable foundation.

Prerequisites

You will need:

  • VPS running Ubuntu

Step 1 – Install Apache

Lighttpd is an open-source web server more optimized for speed-critical environments than common products while remaining standards-compliant, secure and flexible. It is designed and optimized for high-performance environments.

You can install Lighttpd by following this command:

sudo apt install lighttpd

Note: When asks for prompt type Y and hit Enter.

After, you need to start and enable the apache:

sudo systemctl start lighttpd

And enable it:

systemctl enable lighttpd

Allow incoming HTTP and HTTPS traffic:

ufw allow 80/tcp

ufw reload

ufw enable

Step 2 – Install MySQL

Now you need to install MySQL. We will need MySQL to store information on the website.

To install it, run this command:

sudo apt install mariadb-server

After, you need to start and enable it:

systemctl start mariadb

systemctl enable mariadb

Now it’s time to secure the installation.

mysql_secure_installation

You will be asked for a password, so just hit Enter.

After, you will be asked a series of questions.

  • Set root password? [Y/n]

Type y if you want to set.

  • Remove anonymous users? [Y/n]

Type y if you want to remove.

  • Disallow root login remotely? [Y/n]

Type y if you want to disallow.

  • Remove test database and access to it? [Y/n]

Type y to remove.

  • Reload privilege tables now? [Y/n]

Type y to reload privileges.

Step 3 – Install PHP

PHP is a popular general-purpose scripting language that is especially suited. To install PHP and MySQL extension you need to run the following command:

sudo apt install php php-fpm php-mysql php-cli

Restart web service to get effects:

sudo systemctl restart lighttpd

Now open php.ini

nano /etc/php/7.2/fpm/php.ini

And add this line:

cgi.fix_pathinfo=1

Save it. And open www.conf

nano /etc/php/7.2/fpm/pool.d/www.conf

Change this line from:

listen = /run/php/php7.2-fpm.sock

To::

listen = 127.0.0.1:9000

Now open the last file :

nano /etc/lighttpd/conf-available/15-fastcgi-php.conf

Change these lines:

“bin-path” => “/usr/bin/php-cgi”,

“socket” => “/var/run/lighttpd/php.socket”,

To:

“host” => “127.0.0.1”,

“port” => “9000”,

Save it. And enable fastcgi and fastcgi-php modules:

lighty-enable-mod fastcgi

lighty-enable-mod fastcgi-php

Restart lighttpd and php-fpm to take effects:

systemctl restart lighttpd

systemctl restart php7.2-fpm

Step 4 – Test PHP

You need to test PHP if is working. You can do it by running the following command:

echo “<?php phpinfo();” > /var/www/html/phpinfo.php

Now go to your browser and open this URL http://youripaddress/phpinfo.php to see PHP configuration information.

You have successfully installed LLMP Stack in CentOS.

Enjoy.