• Techblog369, India
  • September 29, 2022

How to create PHP QR code and Save it to Database?

Hi In this Article I am going to show how to create QR code and save it to database also fetch QR Code in a Table Create a Page addqrcode.php in …

How to Send Multiple Files Attachment Mail using Laravel

Hi in this article i am going to show how to send multiple files attachment mail in Laravel. It’s simple example of Laravel send multiple attachment in mail. I explained simply …

How to install LEMP stack (Linux, Nginx, MySQL, PHP) on Ubuntu 20.04 VPS

In this tutorial, we will install the LEMP stack on the ubuntu 20 based server. LEMP consists of Linux, Nginx(pronounced as Engine-x), MySQL for database, and PHP as a backend programming language. Together you can use this combination to host a set of high-performing sites on a single server. I will assume that you have finished the initial server setup as described here on your ubuntu server before installing the LEMP stack on Ubuntu 20.04.

If you are already using some other web server like apache2, it is recommended that you uninstall it or rebuild your server from scratch using the console provided by your hosting provider. DigitalOcean gives a convenient way to achieve this in its dashboard.

Before installing the LEAM stack you should create a droplet, create a non-root user, configure ssh. All steps describe in my another Article https://techblog369.in/2021/11/24/how-to-deploy-a-nuxt-js-website-to-a-digitalocean-server/

Let’s install the LEMP stack now. Follow the steps below:

Step 1 – Update the server’s package index

Update the server’s package index by executing the command below:

Once Droplet and Server Installed run the following command

sudo apt update

Step 2 – Install Nginx
Install Nginx using the command below:

sudo apt install nginx

Step 3 – Allow Nginx through the firewall
Allow Nginx through the firewall using the command below:

sudo ufw app list
sudo ufw allow 'Nginx Full'

You should get a listing of the application profiles:

Available applications:
 Nginx Full
 Nginx HTTP
 Nginx HTTPS

You can now go to your server’s IP address to check if Nginx is installed successfully. You should see a page like this:

Step 4 – Installing MySQL

Let’s install MySQL using the command below:

sudo apt install mysql-server

This command will install MySQL, and you will be able to see the console by entering “sudo mysql” in the terminal.

sudo mysql

Step 5 – Installing PHP

The last component in the LEMP stack is PHP. Let’s install it using the command below:

sudo apt install php-fpm php-mysql

If you want to host a PHP website, you will have to copy your files to ‘/var/www/html’ and modify the file located at ‘/etc/nginx/sites-available/default’ to look something like this:

these are the additional lines added inside the “location ~ \.php$ {” block

include fastcgi_params;
fastcgi_index index.php;
fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;

Create a simple index.php under /var/www/html 

Here is a sample index.php site for you to try out:


You will now be able to use PHP with Nginx. Thanks for reading..!



Leave a Reply

Your email address will not be published.