How To Install LEMP stack on Ubuntu

Published: 26 January 2023
on channel: MivoCloud
233
40

The LEMP software stack is a group of software that can be used to serve dynamic web pages and web applications written in PHP. This is an acronym that describes a Linux operating system, with an Nginx (pronounced like “Engine-X”) web server. The backend data is stored in the MySQL database and the dynamic processing is handled by PHP.

This guide demonstrates how to install a LEMP stack on an Ubuntu 20.04 server. The Ubuntu operating system takes care of the first requirement. We will describe how to get the rest of the components up and running.

Commands Used
sudo apt update
sudo apt install nginx
sudo ufw app list
sudo apt install mysql-server
sudo mysql
exit
sudo apt install php-fpm php-mysql
sudo mkdir /var/www/your_domain
sudo chown -R $USER:$USER /var/www/your_domain
sudo nano /etc/nginx/sites-available/your_domain

server {
listen 80;
server_name your_domain www.your_domain;
root /var/www/your_domain;

index index.html index.htm index.php;

location / {
try_files $uri $uri/ =404;
}

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

location ~ /\.ht {
deny all;
}

}

sudo ln -s /etc/nginx/sites-available/your_domain /etc/nginx/sites-enabled/
sudo unlink /etc/nginx/sites-enabled/default
sudo nginx -t
sudo systemctl reload nginx
nano /var/www/your_domain/info.php
sudo rm /var/www/your_domain/info.php

Useful Links
VPS/VDS -


Watch video How To Install LEMP stack on Ubuntu online, duration 02 minute 45 second in high hd quality that is uploaded to the channel MivoCloud 26 January 2023. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 233 times and liked it 40 visitors.