安装 nginx 需要的依赖 #
# 安装 gcc
yum install -y gcc
# 安装 gcc-c++
yum install -y gcc-c++
# 安装 pcre pcre-devel
yum install -y pcre pcre-devel
# 安装 zlib zlib-devel
yum install -y zlib zlib-devel
# 安装 openssl openssl-devel
yum install -y openssl openssl-devel
下载 #
wget http://nginx.org/download/nginx-1.16.1.tar.gz
解压缩 #
tar -zxvf nginx-1.16.1.tar.gz
安装 #
# 进入解压得到的目录
cd nginx-1.16.1
# 配置
./configure
# 编译
make
# 安装
make install
启动、停止 #
# 进入/usr/local/nginx/sbin
cd /usr/local/nginx/sbin
# 启动
./nginx
# 停止
./nginx -s stop
# 重启
./nginx -s reload