Nginx & PCRE 安装问题

原文出处:http://blog.chenlb.com/2010/12/nginx-pcre-install-error-127.html

有台我维护的服务器,没有 root 权限,只有普通用的权限。现在想安装 nginx 做负载均衡。

下载 nginx 0.8.54

  1. ./configure --prefix=/home/admin/nginx  

会报下载的错:

./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 安装

  1.  ./configure --prefix=/home/admin/usr-local  
  2. make  
  3. make install  

然后安装 nginx

  1. cd ~/src/nginx-0.8.54  
  2. ./configure --prefix=/home/admin/nginx --with-pcre=/home/admin/usr-local  

配置正确了

Configuration summary
+ using PCRE library: /home/admin/usr-local
+ OpenSSL library is not used
+ md5: using system crypto library
+ sha1 library is not used
+ using system zlib library

nginx make 的时候报错:

make -f objs/Makefile
make[1]: Entering directory `/home/admin/src/nginx-0.8.54'
cd /home/admin/usr-local \
&& if [ -f Makefile ]; then make distclean; fi \
&& CC="gcc" CFLAGS="-O2 -fomit-frame-pointer -pipe " \
./configure --disable-shared
/bin/sh: line 2: ./configure: No such file or directory
make[1]: *** [/home/admin/usr-local/Makefile] Error 127
make[1]: Leaving directory `/home/admin/src/nginx-0.8.54'
make: *** [build] Error 2

这个我想不明白了。安装了 pcre 还有问题。网上找到答案

--with-pcre=DIR 是指 pcre 的源码目录,而不是 pcre 的安装目录。改了后顺利安装

  1. ./configure --prefix=/home/admin/nginx --with-pcre=/home/admin/src/pcre-8.11 --user=admin  
  2. make  
  3. make install  

但 make 时还有个警告:

objs/src/os/unix/ngx_process.o: In function `ngx_process_get_status':
/home/admin/src/nginx-0.8.54/src/os/unix/ngx_process.c:490: warning: `sys_errlist' is deprecated; use `strerror' or `strerror_r' instead
/home/admin/src/nginx-0.8.54/src/os/unix/ngx_process.c:490: warning: `sys_nerr' is deprecated; use `strerror' or `strerror_r' instead
make[1]: Leaving directory `/home/admin/src/nginx-0.8.54'

看起来问题不大。

关于 nginx 的安装选项可以看 http://wiki.nginx.org/NginxInstallOptions

关于 nginx 负载均衡可以看 http://wiki.nginx.org/HttpUpstreamModule安装 Nginx 配置负载均衡

感谢博文:http://storysky.blog.51cto.com/628458/345630

转载于:https://my.oschina.net/kear/blog/78535

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值