Nginx安装

Nginx安装

一、下载

在这里插入图片描述

  • 下载最新的Stable version稳定版本

二、解压缩

tar -zxvf nginx-1.20.2

三、编译

  • 安装相关依赖
yum install -y gcc pcre-devel zlib-devel
  • 将c语言编写的Nginx文件编译并指定安装位置
#Nginx解压缩目录下
./configure --prefix=/usr/nginx
  • 此时生成文件Makefile
  • 编译并安装

四、安装

make && make install

五、启动

[root@Nginx nginx-1.20.2]# cd /usr/nginx/
[root@Nginx nginx]# ls
conf  html  logs  sbin
[root@Nginx nginx]# cd sbin/
# 启动前
[root@Nginx sbin]# ps -aux|grep nginx
root      12653  0.0  0.0 112824   980 pts/0    R+   10:17   0:00 grep --color=auto nginx
# 启动
[root@Nginx sbin]# ./nginx 
# 启动后
[root@Nginx sbin]# ps -aux|grep nginx
root      12669  0.0  0.0  20572   616 ?        Ss   10:18   0:00 nginx: master process ./nginx
nobody    12671  0.0  0.0  23100  1376 ?        S    10:18   0:00 nginx: worker process
root      12678  0.0  0.0 112824   980 pts/0    R+   10:18   0:00 grep --color=auto nginx

  • 登录服务器

在这里插入图片描述

  • 成功启动

六、停止服务

[root@Nginx sbin]# ./nginx -s stop
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值