Linux centos7 nginx编译安装步骤

时间:2021-01-09 15:21:06

创建安装目录

mkdir /application
cd /application

下载安装包

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

安装依赖

yum install pcre pcre-devel -y
yum install openssl openssl-devel -y

创建nginx用户

useradd -s /sbin/nologin www -M

解压ningx包

tar xf nginx-1.16.0.tar.gz

编译安装

./configure --user=www --group=www --prefix=/application/nginx-1.16.0 --with-http_stub_status_module --with-http_ssl_module --with-pcre
    make & make install

创建连接

ln -s /application/nginx-1.16.0/ /application/nginx
 ls /application/nginx

开启nginx

/application/nginx/sbin/nginx

查看nginx进程

lsof -i :80
每一步结尾用echo $?验证是否正确。