环境准备
yum install -y lrzsz wget vim unzip net-tools gcc openssl openssl-devel pcre pcre-devel zlib zlib-devel
注:有些组件不是必需的,是为方便操作的
下载及安装
groupadd nginx
useradd -s /sbin/nologin -M -g nginx nginx
mkdir -p /root/software
cd /root/software
wget http://nginx.org/download/nginx-1.16.1.tar.gz
tar zxf nginx-1.16.1.tar.gz
cd nginx-1.16.1
./configure --user=nginx --prefix=/user/local/nginx-1.16.1 --with-http_stub_status_module --with-http_ssl_module
make&&make install
echo "export PATH=$PATH:/user/local/nginx-1.16.1/sbin" >> /etc/profile
source /etc/profile
启动关闭
nginx #启动nginx
nginx -s stop #关闭nginx
nginx -s reload #重新加载配制信息
nginx -t
验证安装情况
curl 127.0.0.1
ps fax|grep nginx