nginx第三方module安装报错./configure: error

在执行 ./configure命令时,提示报以下错误:

错误为:./configure: error: 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=<path> option.

解决方案

yum -y install pcre-devel

错误为:./configure: error: the HTTP cache module requires md5 functions from OpenSSL library.

解决方案

yum -y install openssl openssl-devel

make

make install

nginx不支持动态安装、加载模块的,所以当你安装第三方模块或者启动nginx本身的新模块功能的时候,都是覆盖nginx的;所以,一定要注意:首先查看你已经安装的nginx模块!然后安装新东西的时候,要把已安装的,再次配置。

nginx第三方模块安装方法:

./configure --prefix=/你的安装目录  --add-module=/第三方模块目录

上面已经讲清楚了,安装任何新功能的时候,一定要先查看现有的,

第一步:查看nginx现有的配置

cd /usr/local/sbin/

./nginx -V 查看configure arguments: 后面的项,有可能是空的,说明什么都没有配置。

举例:

configure arguments: --add-module=/home/softback/echo-nginx-module-0.60

说明已经安装了第三方的echo模块。那么下面再安装https支持,或者其它第三方模块的时候,./configure后面一定还要带上–add-module=/home/softback/echo-nginx-module-0.60 ,否则会被覆盖的。

第二步:安装模块

1、在未安装nginx的情况下安装nginx第三方模块(需要make install)

./configure --prefix=/usr/local/nginx \
--with-http_stub_status_module \
--with-http_ssl_module --with-http_realip_module \
--with-http_image_filter_module \
--add-module=.. /ngx_pagespeed-master  --add-module=/第三方模块目录
 make
 make isntall
 /usr/local/nginx/sbin/nginx //启动nginx

2、在已安装nginx情况下安装nginx模块(不需要make install,只需要make)

./configure --prefix=/usr/local/nginx \
  --with-http_stub_status_module \
  --with-http_ssl_module --with-http_realip_module \
  --with-http_image_filter_module \
  --add-module=.. /ngx_pagespeed-master
 make
 /usr/local/nginx/sbin/nginx -s stop
 cp objs/nginx /usr/local/nginx/sbin/nginx
 /usr/local/nginx/sbin/nginx //启动nginx

总结,安装nginx安装第三方模块实际上是使用–add-module重新安装一次nginx,不要make install而是直接把编译目录下objs/nginx文件直接覆盖老的nginx文件.如果你需要安装多个nginx第三方模块,你只需要多指定几个相应的–add-module即可.

备注:重新编译的时候,记得一定要把以前编译过的模块一同加到configure参数里面.

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

C+ 安口木

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值