CentOS7下源码编译安装nginx详解与卸载nginx

  • 时间:2025-11-05 16:31 作者: 来源: 阅读:0
  • 扫一扫,手机访问
摘要:操作系统:CentOS7安装版本:nginx1.18【官网】http://nginx.org/en/download.html一、安装nginx1)安装编译工具yum install gcc automake autoconf libtool gcc-c++2)切换到下载目录后下载nginx源码包cd /home/installwget http://nginx.org/download/ngin

操作系统:CentOS7

安装版本:nginx1.18

【官网】http://nginx.org/en/download.html

一、安装nginx

1)安装编译工具

yum install gcc automake autoconf libtool gcc-c++

2)切换到下载目录后下载nginx源码包

cd /home/install

wget http://nginx.org/download/nginx-1.18.0.tar.gz

CentOS7下源码编译安装nginx详解与卸载nginx

3)在/home/install目录下就会有nginx-1.18.0.tar.gz,然后解压

tar -zxvf nginx-1.18.0.tar.gz

4)进入解压目录nginx-1.18.0下进行编译安装

cd nginx-1.18.0

./configure --prefix=/usr/local/nginx    (--prefix指定安装目录)

make

make install


CentOS7下源码编译安装nginx详解与卸载nginx

5)启动nginx

service nginx start

(若出现:-bash:nginx:未找到命令(command not found)请查看:nginx:未找到命令解决方法)

(若出现:Failed to start nginx.service: Unit not found. 请查看:启动nginx失败解决方法)

6)使用浏览器访问 http://你的IP,出现以下就是安装完成了!

CentOS7下源码编译安装nginx详解与卸载nginx


nginx基本操作命令

    systemctl start nginx.service(service nginx start)

    systemctl stop nginx.service(service nginx stop)

    systemctl reload nginx.service(service nginx restart)

    systemctl status nginx.service(service nginx status)


二、卸载

yum remove nginx

  • 全部评论(0)
手机二维码手机访问领取大礼包
返回顶部