操作系统: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
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
5)启动nginx
service nginx start
(若出现:-bash:nginx:未找到命令(command not found)请查看:nginx:未找到命令解决方法)
(若出现:Failed to start nginx.service: Unit not found. 请查看:启动nginx失败解决方法)
6)使用浏览器访问 http://你的IP,出现以下就是安装完成了!
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
网友评论