Skip to content

Latest commit

 

History

History
75 lines (73 loc) · 1.27 KB

LEMP_Stack_Installation.md

File metadata and controls

75 lines (73 loc) · 1.27 KB

How to Install LEMP (Linux Nginx MySQL PHP) Stack

  • To Get Access via SSH
Syntax:- ssh -p PORT USERNAME@HOSTIP
Example:- ssh -p 22 [email protected]
  • Updates the package lists for Upgrades then Upgrade
sudo apt update
sudo apt upgrade
  • Install Nginx
sudo apt install nginx
  • Allow Apache through Firewall
sudo ufw allow "Nginx Full"
  • Check Server IP on Web Browser You will see Nginx Default Page
  • Install MySQL
sudo apt install mysql-server
  • Install PHP
sudo apt install php-fpm php-mysql
The above command includes three packages:-
php-fpm -  To Install PHP and php-fpm
php-mysql - It is a PHP module that allows PHP to connect to MySQL 
  • Check php-fpm is running
sudo service php8.1-fpm status
OR
sudo systemctl status php8.1-fpm
  • Check Nginx Status
sudo service nginx status
OR
sudo systemctl status nginx
  • Start Nginx
sudo service nginx start
OR
sudo systemctl start nginx
  • Stop Nginx
sudo service nginx stop
OR
sudo systemctl stop nginx
  • Test Nginx Config
sudo nginx -t
OR
sudo service nginx configtest
  • Reload Nginx
sudo service nginx reload
OR
sudo systemctl reload nginx
  • Restart Nginx
sudo service nginx restart
OR
sudo systemctl restart nginx