1、安装所需环境
//安装gcc
yum install gcc-c++
//安装PCRE pcre-devel
yum install -y pcre pcre-devel
//安装zlib
yum install -y zlib zlib-devel
//安装Open SSL
yum install -y openssl openssl-devel
2、创建nginx目录并下载安装包
//进入usr/local目录
cd /usr/local
//创建nginx目录
mkdir nginx
//进入nginx目录
cd nginx
//下载tar包
wget http://nginx.org/download/nginx-1.18.0.tar.gz
//解压tar
tar -xvf nginx-1.18.0.tar.gz
也可以自己去官网下载,上传到linux
官网地址:http://nginx.org/download/
3、安装nginx
//进入nginx目录
cd /usr/local/nginx/nginx-1.13.7
//执行命令
./configure
//执行make命令(要是执行不成功请检查最开始安装的四个有没有安装成功)
make
//执行make install命令
make install
4、启动nginx
//进入/usr/local/nginx/sbin目录,输入./nginx即可启动nginx
./nginx
//关闭nginx
./nginx -s quit 或者 ./nginx -s stop
//重启nginx
./nginx -s reload
//查看nginx进程
ps -ef|grep nginx
5、设置开启自启动
//编辑
vi /etc/rc.local
//最底部增加这一行
/usr/local/nginx/sbin/nginx
标签:tar,安装,nginx,usr,install,Linux,local
From: https://www.cnblogs.com/wchsg/p/16829043.html