Nginx编译安装
关于Nginx编译安装,只需要几步就行了,但是这个过程中会有很多错误,因为nginx有一些依赖包,系统本身没有所以就会出现问题。
先进行nginx包的下载,到官网:
http://nginx.org/
下载后,解包,并进入nginx:
开始nginx安装:
当然没这容易就安装好了,可能会出现以下一些问题,解决问题后,重新走上面的开始nginx安装三个步骤
错误一:the HTTP rewrite module requires the PCRE library.
./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= option.
缺少pcre
安装pcre
下载包:http://sourceforge.net/projects/pcre/files/
安装好后,执行nginx安装:
错误二:安装pcre出错:You need a C++ compiler for C++ support
安装c++支持
linux下安装安装pcre-8.32 configure: error: You need a C++ compiler for C++ support
./configure --prefix=/usr/local/pcre 出现以下错误
configure: error: You need a C++ compiler for C++ support
缺少c++编译器的原因
错误三:the HTTP gzip module requires the zlib library.缺少zlib
./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= option.
安装zlib
错误四:make[1]: *** [/usr/local/pcre/Makefile] Error 127.pcre指向错误
./configure --prefix=/export/lnmp/nginx-1.4.7 --with-pcre=/usr/local/pcre-8.34
./configure --help | grep '\--with-pcre'
--with-pcre=DIR set path to PCRE library sources
指向源码包,不是编译安装后的包,所以
./configure --prefix=/export/lnmp/nginx-1.4.7 --with-pcre=../pcre-8.34
OK
先进行nginx包的下载,到官网:
http://nginx.org/
下载后,解包,并进入nginx:
tar -zxf nginx-1.4.7.tar.gz
cd nginx-1.4.7
开始nginx安装:
./configure
make
make install
当然没这容易就安装好了,可能会出现以下一些问题,解决问题后,重新走上面的开始nginx安装三个步骤
错误一:the HTTP rewrite module requires the PCRE library.
./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=
缺少pcre
安装pcre
下载包:http://sourceforge.net/projects/pcre/files/
tar -zxvf pcre-8.34.tar.gz
cd pcre-8.34
./configure --prefix=/usr/local/pcre
make
make install
安装好后,执行nginx安装:
./configure --prefix=/export/lnmp/nginx-1.4.7 --with-pcre=../pcre-8.34
make
make install
错误二:安装pcre出错:You need a C++ compiler for C++ support
安装c++支持
linux下安装安装pcre-8.32 configure: error: You need a C++ compiler for C++ support
./configure --prefix=/usr/local/pcre 出现以下错误
configure: error: You need a C++ compiler for C++ support
缺少c++编译器的原因
yum install -y gcc gcc-c++
错误三:the HTTP gzip module requires the zlib library.缺少zlib
./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=
安装zlib
yum install -y zlib-devel
错误四:make[1]: *** [/usr/local/pcre/Makefile] Error 127.pcre指向错误
./configure --prefix=/export/lnmp/nginx-1.4.7 --with-pcre=/usr/local/pcre-8.34
./configure --help | grep '\--with-pcre'
--with-pcre=DIR set path to PCRE library sources
指向源码包,不是编译安装后的包,所以
./configure --prefix=/export/lnmp/nginx-1.4.7 --with-pcre=../pcre-8.34
OK