Centos7下安装Nginx遇到的一些问题

/ nginx / 没有评论 / 2970浏览

首先从官网下载安装包(源码),解压到一个目录下。 进入存放的目录下执行

./configure

可能会出现以下错误提示,没有编译模块

checking for OS
 + Linux 3.10.0-123.el7.x86_64 x86_64
checking for C compiler ... not found

./configure: error: C compiler cc is not found

执行命令安装编译模块

yum -y install gcc gcc-c++ autoconf automake make

安装完成会提示complete! 再次执行./configure,可能会出现以下提示

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.

执行命令

yum -y install pcre-devel

可能会出下以下提示

./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 -y install zlib-devel