How To Install Linux, Nginx, MySQL, PHP (LEMP stack) on Ubuntu 18.04

How To Install Linux, Nginx, MySQL, PHP (LEMP stack) on Ubuntu 18.04

How To Install Linux, Nginx, MySQL, PHP (LEMP stack) on Ubuntu 18.04

In this tutorial, we will guide you on how to install LEMP stack on Ubuntu 18.04. LEMP stack is a popular web development stack that comprises of Linux, Nginx, MySQL, and PHP.

Prerequisites

Before you begin with the installation, you need to have the following:

  • A running instance of Ubuntu 18.04.
  • Sudo privileges on the server.

Step 1: Install Linux

The first step is to install Linux on your Ubuntu 18.04 server. You can install the latest version of Ubuntu 18.04 LTS from the official website.

Step 2: Install Nginx

Once you have installed Linux, the next step is to install Nginx. You can install Nginx using the following command:

sudo apt-get update sudo apt-get install nginx

Step 3: Install MySQL

The next step is to install MySQL. You can install MySQL using the following command:

sudo apt-get install mysql-server

Step 4: Install PHP

The final step is to install PHP. You can install PHP using the following command:

sudo apt-get install php-fpm php-mysql

Step 5: Configure Nginx to Use PHP

Now that you have installed all the necessary components, you need to configure Nginx to use PHP. You can do this by editing the Nginx configuration file using the following command:

sudo nano /etc/nginx/sites-available/default

Once you have opened the file, find the line that starts with index and add index.php to the end of it, like so:

index index.php index.html index.htm;

Next, find the following block of code:

location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.2-fpm.sock; }

And uncomment it by removing the # at the beginning of each line.

Step 6: Restart Nginx and PHP-FPM

Finally, restart Nginx and PHP-FPM to apply the changes you have made to the configuration files:

sudo systemctl restart nginx sudo systemctl restart php

Комментарии

Популярные сообщения из этого блога

How To Modify CSS Classes in JavaScript

How To Backup MySQL Databases on an Ubuntu VPS

How To Backup PostgreSQL Databases on an Ubuntu VPS