Raspberry Pi learning (3) LNMP server configuration

1: Install Nginx;

sudo apt-get install nginx

If you need to uninstall:

sudo apt-get --purge remove nginx
sudo apt-get --purge remove nginx-common
sudo apt-get --purge remove nginx-core

2: Install PHP7 and plug-ins

sudo apt-get install php7.3
sudo apt-get install php7.3-fpm
sudo apt-get install php7.3-mysql
sudo apt-get install php7.3-common

3. Install MYSQL (MariaDB)

sudo apt-get install mariadb-sever
sudo apt-get install mariadb-client

4. Configure Nginx

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

Find this part

Insert picture description here

and replace it with: note that the space must be typed correctly;

Insert picture description here

after finishing Ctrl+O, press Enter to save, Ctrl+X to exit;
5: restart the service

sudo /etc/init.d/nginx restart
sudo /etc/init.d/php7.3-fpm restart
sudo service mysql restart
sudo service nginx restart

6: Perform Nginx and PHP testing

sudo chmod -R 777 /var
sudo chmod -R 777 /var/www/
sudo chmod -R 777 /var/www/html

Create a new file index.php under /var/www/html,
open and enter

		<?php echo '<p>Hello World</p>';?>

Save and exit; delete the other two HTML files;
open the browser, enter the IP address of the Raspberry Pi, and press Enter;

Insert picture description here

if this appears, the test is successful;