nginx在CentOS7中安装,执行如下代码
./configure
先碰到如下问题:
./configure: error: the HTTP rewrite module requires the PCRE library.
需要安装pcre-devel与openssl-devel,执行如下代码:
yum -y install pcre-devel openssl openssl-devel
再执行第一句代码,还会碰到如下问题:
./configure: error: the HTTP gzip module requires the zlib library.
解决方法如下:先下载解压并编译安装zlib
wget http://www.zlib.net/zlib-1.2.11.tar.gz
tar -xzvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure
make
make install
如果make命令执行出问题,先安装make编译工具:
yum -y install make
然后再执行如下代码,nginx就安装成功了
./configure
make
make install
可以用如下代码查看nginx命令在哪
whereis nginx
结果:
nginx: /usr/local/nginx