1、解压
tar -zxvf nginx.tar.gz
2、进入解压后的文件
cd nginx
3、执行configure文件./configure
可能会有报错:
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=path option.
yum安装依赖yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
4、执行make
命令
5、执行make install
命令
make PREFIX=[路径] install
可以指定安装位置
6、执行whereis nginx
命令