1、docker pull centos:centos8
2、进入容器
docker run -it centos:centos8 /bin/bash
3、安装git
yum install -y git
4、安装nvm
git clone https://github.com/creationix/nvm.git
source nvm/nvm.sh
5、修改环境变量
vi ~/.bash_profile
加入source nvm/nvm.sh
更新
source ~/.bash_profile
6、安装node
nvm install 14.9.0
使用
nvm use 14.9.0
7、全部安装pm2
npm install -g pm2
8、更新yum
源
yum update
9、安装wget
yum install wget
10、安装nginx
cd /usr/local/src
wget http://nginx.org/download/nginx-1.18.0.tar.gz
11、安装gcc 、make编译器和Nginx依赖包
yum install -y gcc make pcre-devel zlib-devel
12、开始编译
tar -xf nginx-1.18.0.tar.gz
cd nginx-1.18.0
./configure --prefix=/usr/local/nginx --with-pcre
make
make install
13、启动nginx
/usr/local/nginx/sbin/nginx
查看nginx是否启动成功
curl localhost
14、启动、停止nginx
cd /usr/local/nginx/sbin/
./nginx
./nginx -s stop
./nginx -s quit
./nginx -s reload