Linux中安装Nginx
1)下载

2)上传
把 nginx-1.20.1.tar.gz 文件上传到 linux 上


3)解压
- 执行 tar -zxvf nginx-1.20.1.tar.gz 命令,对 nginx 进行解压


4)编译

- 执行 ./configure 可能会报错,有两种,分别如下:


-
解决办法: 执行下面的命令,安装 pcre-devel
yum -y install pcre-deve
yum install -y zlib-devel
结尾出现这个算是成功



5)启动
- 使用 whereis nginx 命令查看有没有 nginx


- 进入 sbin 目录,启动 nginx,它没有日志,没报错就算成功

- 打开浏览器,输入自己的服务器 ip:80 访问 nginx ,访问的时候注意 80 端口是否被占用,或者云服务器的 80 端口是否被放行

6)关闭
使用 ./nginx -s stop ,关闭nginx

3、Nginx 常用命令
./nginx
./nginx -s stop
./nginx -s quit
./nginx -s reload
ps aux|grep nginx
关闭nginx
[外链图片转存中…(img-MRSBzADa-1628343801469)]
3、Nginx 常用命令
./nginx
./nginx -s stop
./nginx -s quit
./nginx -s reload
ps aux|grep nginx
|