nginx源代码安装make报错

今天在安装nginx时出现如下错误:

[root@node1 nginx-0.8.55]# ./configure \ 
>  --prefix=/usr \ 
>  --sbin-path=/usr/sbin/nginx \ 
>  --conf-path=/etc/nginx/nginx.conf \ 
>  --error-log-path=/var/log/nginx/error.log \ 
>  --pid-path=/var/run/nginx/nginx.pid  \ 
>  --lock-path=/var/lock/nginx.lock \ 
>  --user=nginx \ 
>  --group=nginx \ 
>  --with-http_ssl_module \ 
>  --with-http_flv_module \ 
>  --with-http_gzip_static_module \ 
>  --http-log-path=/var/log/nginx/access.log \ 
>  --http-client-body-temp-path=/var/tmp/nginx/client/ \ 
>  --http-proxy-temp-path=/var/tmp/nginx/proxy/ \ 
>  --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/

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

上面步骤很明显缺少了一个叫pcre的库文件,安装好后并指定路径,我们接着安装。
12 [root@node1 pcre-8.02]# ./configure --prefix=/usr/local/pcre 
[root@node1 pcre-8.02]# make && make install

安装正常我们接着安装nginx.
[root@node1 nginx-0.8.55]# ./configure \
>  --prefix=/usr \
>  --sbin-path=/usr/sbin/nginx \
>  --conf-path=/etc/nginx/nginx.conf \
>  --error-log-path=/var/log/nginx/error.log \
>  --pid-path=/var/run/nginx/nginx.pid  \
>  --lock-path=/var/lock/nginx.lock \
>  --user=nginx \
>  --group=nginx \
>  --with-http_ssl_module \
>  --with-http_flv_module \
>  --with-http_gzip_static_module \
>  --http-log-path=/var/log/nginx/access.log \
>  --http-client-body-temp-path=/var/tmp/nginx/client/ \
>  --http-proxy-temp-path=/var/tmp/nginx/proxy/ \
>  --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
>  --with-pcre=/usr/local/pcre

当使用make时报了如下错误:

[root@node1 nginx-0.8.55]# make 
make -f objs/Makefile 
make[1]: Entering directory `/nginx/nginx-0.8.55' 
cd /usr/local/pcre \ 
        && if [ -f Makefile ]; then make distclean; fi \ 
        && CC="gcc" CFLAGS="" \ 
        ./configure --disable-shared 
/bin/sh: line 2: ./configure: 没有那个文件或目录 
make[1]: *** [/usr/local/pcre/Makefile] 错误 127 
make[1]: Leaving directory `/nginx/nginx-0.8.55' 
make: *** [build] 错误 2

通过查阅资料原来检测环境时,不是指向安装后目录,指向pcre的源目录。如下所示即可

[root@node1 nginx-0.8.55]# ./configure \ 
>  --prefix=/usr \ 
>  --sbin-path=/usr/sbin/nginx \ 
>  --conf-path=/etc/nginx/nginx.conf \ 
>  --error-log-path=/var/log/nginx/error.log \ 
>  --pid-path=/var/run/nginx/nginx.pid  \ 
>  --lock-path=/var/lock/nginx.lock \ 
>  --user=nginx \ 
>  --group=nginx \ 
>  --with-http_ssl_module \ 
>  --with-http_flv_module \ 
>  --with-http_gzip_static_module \ 
>  --http-log-path=/var/log/nginx/access.log \ 
>  --http-client-body-temp-path=/var/tmp/nginx/client/ \ 
>  --http-proxy-temp-path=/var/tmp/nginx/proxy/ \ 
>  --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \ 
>  --with-pcre=/usr/local/pcre-8.02 
[root@node1 nginx-0.8.55]# make && make install

OK!安装成功


我在安装nginx时的操作:./configure --prefix=/usr/local/opt/nginx --with-pcre=/usr/local/opt/pcre-8.31/

然后make && make install

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值