1.安装nginx前,需要先安装pcre
这一步我先安装了较新版本的pcre2,后来编译nginx的时候出错,原因是找不到pcre.h,因为新的版本生成的是pcre2.h,装回老版本后问题解决
./configure --prefix=/usr/local/webserver/pcre
make && make install
2. nginx安装(以下为参考网上资料)
编译参数:
--[root@localhost nginx-1.4.6]# ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/pcre/NGINX编译通过后,make时报错如下:
主要错误:make[1]: *** [/usr/local/pcre//Makefile] Error 127
查看了下帮助
[root@localhost nginx-1.4.6]# ./configure --help | grep '\--with-pcre' --with-pcreforce PCRE library usage --with-pcre=DIRset path to PCRE library sources --with-pcre-opt=OPTIONSset additional build options for PCRE --with-pcre-jitbuild PCRE with JIT compilation support[root@localhost nginx-1.4.6]#
发现--with-pcre=DIR是设置pcre的源码目录,而不是pcre的安装目录
重新修改Nginx编译参数
[root@localhost nginx-1.4.6]# ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/src/pcre-8.10/编译通过后执行make && make install 都应该不会有问题
本文出自 “小科” 博客,请务必保留此出处