LNMP: win10 building ubuntu18.04 subsystem and building LNMP

Time:2021-9-8

Open developer mode

System settings – > update and security – > for developers – > select developer mode
LNMP: win10 building ubuntu18.04 subsystem and building LNMP

Enable Linux subsystem components

System settings – > applications – > programs and functions on the right – > start or turn off windows functions – > check the windows subsystem applicable to Linux.
After setting, restart the update

Replace alicloud source

Alibaba cloud Ubuntu 18.04 source

deb http://mirrors.aliyun.com/ubu… bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubu… bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubu… bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubu… bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubu… bionic-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubu… bionic main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubu… bionic-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubu… bionic-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubu… bionic-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubu… bionic-backports main restricted universe multiverse

Replace apt source: (back up first)

cd /etc/apt/
sudo cp sources.list sources.list.bak
sudo vim sources.list

Delete all contents and replace with the uppermost source content: (the command to delete all lines under VIM)  : 1,$d  )

Then execute

sudo apt update
sudo apt upgrade

Installing nginx

Installing nginx

sudo apt-get install nginx

View nginx version

sudo nginx -v

start nginx

sudo /etc/init.d/nginx start

Stop nginx

sudo /etc/init.d/nginx stop

Restart nginx

sudo /etc/init.d/nginx restart

Install Apache 2

Install Apache 2

sudo apt-get install apache2

View Apache 2 version

sudo apache2 -v

Change the port number of Apache 2 to 8080 (because it conflicts with the port number of nginx)

1. Modify in the file ports.conf

sudo vi /etc/apache2/ports.conf

The corresponding file content is modified as:

NameVirtualHost *:8080
Listen 8080

2. Modify virtualhost in default

sudo vi /etc/apache2/sites-available/000-default.conf

The first line of the file is modified to read:

<VirtualHost *:8080>

Start apache2

sudo /etc/init.d/apache2 start

Stop apache2

sudo /etc/init.d/apache2 stop

Restart Apache 2

sudo /etc/init.d/apache2 restart

Possible problems

 * Starting Apache httpd web server apache2     
 [Mon Jun 15 10:23:47.234556 2020] [core:warn] [pid 153] (92)Protocol not available: AH00076: Failed to enable APR_TCP_DEFER_ACCEPT
 *

terms of settlement:

Add a line in / etc / apache2 / apache2.conf

AcceptFilter http none
Acceptfilter HTTPS none (if HTTPS is enabled)

Restart Apache and solve the problem

Installing php7.2

sudo apt-get -y install php7.2

Start PHP FPM

sudo /etc/init.d/php-fpm start

Install MySQL

sudo apt-get install mysql-server
sudo apt-get install mysql-client