nginx自定义安装路径

安装路径:/usr/local/tools/nginx-1.9.9

1.前期准备

安装编译需要的gcc和gcc-c++

yum install -y gcc gcc-c++

nginx依赖

pcre-devel、openssl-devel、zlib-devel

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

下载nginx源码包并解压到当前目录

cd /tools

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

tar -zxf nginx-1.12.0.tar.gz

 

2.nginx编译安装

生成Makefile文件

cd nginx-1.12.0

./configure --prefix=/usr/local/tools/nginx

编译源代码并安装

make && make install

安装成功,进入/sbin/nginx启动即可