手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

源码安装Nginx报错解决一例

[日期:2013-07-08] 来源:Linux社区  作者:xiaolangit [字体:大 中 小]

今天在安装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重新编译添加模块 http://www.linuxidc.com/Linux/2013-06/86438.htm

Ubuntu 13.04 安装最新版本的nginx http://www.linuxidc.com/Linux/2013-06/85331.htm

Ubuntu 编译安装nginx服务 http://www.linuxidc.com/Linux/2013-06/85330.htm

CentOS 6.4 源码安装nginx之LNMP http://www.linuxidc.com/Linux/2013-04/83419.htm

linux
相关资讯       Nginx安装 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款