nginx开启错误日志,然后重启nginx,出现如下信息:

2016/12/03 09:40:38 [notice] 18858#0: ModSecurity for nginx (STABLE)/2.9.1 (http://www.modsecurity.org/) configured.
2016/12/03 09:40:38 [notice] 18858#0: ModSecurity: APR compiled version="1.4.8"; loaded version="1.4.8"
2016/12/03 09:40:38 [notice] 18858#0: ModSecurity: PCRE compiled version="8.39 "; loaded version="8.32 2012-11-30"
2016/12/03 09:40:38 [warn] 18858#0: ModSecurity: Loaded PCRE do not match with compiled!
2016/12/03 09:40:38 [notice] 18858#0: ModSecurity: LIBXML compiled version="2.9.1"
2016/12/03 09:40:38 [notice] 18858#0: ModSecurity: StatusEngine call: "2.9.1,nginx,1.4.8/1.4.8,8.39/8.32 2012-11-30,(null),2.9.1,1041d4bc04a4b99eb3aab2c7d5ad7bbeb72f7b5b"
2016/12/03 09:40:38 [notice] 18858#0: ModSecurity: StatusEngine call successfully sent. For more information visit: http://status.modsecurity.org/

注意红色字体部分就是兼容性的错误提示:

要求PCRE的软件版本是8.39,系统加载的是软件版本是8.32,所以更新PCRE软件版本到8.39即可解决这个问题。

那么问题来了

通过/usr/local/nginx/sbin/nginx -V 查看nginx的编译参数,PCRE的软件版本是8.39

nginx version: nginx/1.10.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC)
built with OpenSSL 1.0.2j  26 Sep 2016
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-openssl=/usr/local/src/openssl-1.0.2j --with-zlib=/usr/local/src/zlib-1.2.8 --with-pcre=/usr/local/src/pcre-8.39 --add-module=/usr/local/src/modsecurity-2.9.1/nginx/modsecurity

也就是说在安装nginx的时候已经安装pcre8.39软件版本了,但是看系统上的pcre软件版本却不是8.39,还是系统本身自带的软件版本8.32,具体查看如下:

# rpm -qa | grep pcre
pcre-devel-8.32-15.el7_2.1.x86_64
pcre-8.32-15.el7_2.1.x86_64

# pcre-config --version
8.32

解决方法:

1、查看系统安装的pcre软件

#rpm -qa | grep pcre
pcre-devel-8.32-15.el7_2.1.x86_64
pcre-8.32-15.el7_2.1.x86_64

2、系统自带的千万别卸载,直接源码安装最新的就行

3、下载pcre.39源码进行安装

wget http://ftp.exim.llorien.org/pcre/pcre-8.39.tar.gz

tar zxvf pcre-8.39.tar.gz

cd pcre-8.39

./configure --prefix=/usr --docdir=/usr/share/doc/pcre-8.39 --libdir=/usr/lib64 --enable-unicode-properties --enable-pcre16 --enable-pcre32 --enable-pcregrep-libz --enable-pcregrep-libbz2 --disable-static --enable-utf8 --enable-shared

make && make install

然后重启nginx,则不会出现ModSecurity兼容性显示,nginx错误日志如下显示:

2016/12/03 10:09:50 [notice] 28116#0: ModSecurity for nginx (STABLE)/2.9.1 (http://www.modsecurity.org/) configured.
2016/12/03 10:09:50 [notice] 28116#0: ModSecurity: APR compiled version="1.4.8"; loaded version="1.4.8"
2016/12/03 10:09:50 [notice] 28116#0: ModSecurity: PCRE compiled version="8.39 "; loaded version="8.39 2016-06-14"
2016/12/03 10:09:50 [notice] 28116#0: ModSecurity: LIBXML compiled version="2.9.1"
2016/12/03 10:09:50 [notice] 28116#0: ModSecurity: StatusEngine call: "2.9.1,nginx,1.4.8/1.4.8,8.39/8.39 2016-06-14,(null),2.9.1,1041d4bc04a4b99eb3aab2c7d5ad7bbeb72f7b5b"
2016/12/03 10:09:50 [notice] 28116#0: ModSecurity: StatusEngine call successfully sent. For more information visit: http://status.modsecurity.org/

查看pcre软件版本:

#rpm -qa | grep pcre (系统自带的未卸载,还会有信息显示出来)

pcre-devel-8.32-15.el7_2.1.x86_64
pcre-8.32-15.el7_2.1.x86_64

#pcre-config --version (查看到软件版本是8.39)
8.39

#pcretest -C (换个命令查看还是8.39)
PCRE version 8.39 2016-06-14
Compiled with
  8-bit support
  UTF-8 support
  16-bit support
  UTF-16 support
  32-bit support
  UTF-32 support
  Unicode properties support
  No just-in-time compiler support
  Newline sequence is LF
  \R matches all Unicode newlines
  Internal link size = 2
  POSIX malloc threshold = 10
  Parentheses nest limit = 250
  Default match limit = 10000000
  Default recursion depth limit = 10000000
  Match recursion uses stack

# ldconfig -v | grep pcre
ldconfig: 无法对 /libx32 进行 stat 操作: 没有那个文件或目录
ldconfig: 多次给出路径“/usr/lib”
ldconfig: 多次给出路径“/usr/lib64”
ldconfig: 无法对 /usr/libx32 进行 stat 操作: 没有那个文件或目录
        libpcreposix.so.0 -> libpcreposix.so.0.0.4
        libpcrecpp.so.0 -> libpcrecpp.so.0.0.1
        libpcre32.so.0 -> libpcre32.so.0.0.7
        libpcre16.so.0 -> libpcre16.so.0.2.7
        libpcre.so.1 -> libpcre.so.1.2.7

ningx配置ModSecurity重启出现兼容性问题:ModSecurity: Loaded PCRE do not match with compiled!的解决方法的更多相关文章

  1. WPF:指定的命名连接在配置中找不到、非计划用于 EntityClient 提供程序或者无效的解决方法

    文/嶽永鹏 WPF 数据绑定中绑定到ENTITY,如果把数据文件做成一个类库,在UI文件中去应用它,可能遇到下面这种情况. 指定的命名连接在配置中找不到.非计划用于 EntityClient 提供程序 ...

  2. 配置server.xml后,启动tomcat 失败(Unable to start cluster)及解决方法

    在配置负载均衡环境过程中修改server.xml  后重启tomcat报错,报错信息如下 [root@Alice bin]# ./catalina.sh runUsing CATALINA_BASE: ...

  3. 配置webstorm使用supervisor时出现 /usr/bin/env: node: 没有那个文件或目录 解决方法

    配置好supervisor路径后 出现了 启动时出现了 /usr/bin/env: node: 没有那个文件或目录 需要讲.nvm下的node链接到, /usr/bin/目录下 sudo ln -s ...

  4. 在 ServiceModel 客户端配置部分中,找不到引用协定“XX”的默认终结点元素的解决方法

    今天在CRM2011中写Plugin的的时调用WCF报错,错误如下:"在 ServiceModel 客户端配置部分中,找不到引用协定"XX"的默认终结点元素.这可能是因为 ...

  5. VS2010 永久配置OpenCv2.4.9 及转换到COFF 期间失败:文件无效或损坏,解决方法

    1.下载OpenCv2.4.9(win pack):http://opencv.org/releases.html 下载完成后,进行解压(win7 64位系统) 2.环境配置,配置如下图所示: 找到p ...

  6. .Net 配置 swagger 使用nginx反向代理后请求带端口号导致无法正常访问---解决方法

    1 webconfig中 appsetting 中增加配置 <appSettings> <add key="aspnet:UseHostHeaderForRequestUr ...

  7. TP5动态路由配置好了但是报错was not found on this server的原因以及解决方法

    问题:The requested URL /xxxx.html was not found on this server 原因:apache的重写未开启,开启重写后,问题解决, 方法如下: apach ...

  8. Linux/CentOS 配置Mysql-server过程和遇到错误解决方法

    第一步:下载mysql-server 方法1.wget url(你所要下载的链接,可以从mysq官网查找)到当前目录下 方法2.到mysql官网下载包之后通过xftp传到linux 第二步:解压tar ...

  9. docker+mysql 更改配置后重启不了的解决方案

    docker+mysql 更改配置后重启不了的解决方案 前提:在最近的项目中,决定将项目改造成数据库读写分离的架构,于是擅自更改生产环境的数据库的配置文件my.cnf,由于我是用docker进行部署的 ...

随机推荐

  1. Android程序的签名保护及绕过方法

    随着Android 市场的扩大,各类盗版.破解.打包党纷纷涌现,其使用的手法无非是apk _> smali ->修改代码 ->重打包签名,为对抗此类技术,广大程序员挖掘了Androi ...

  2. oracle中分组排序函数用法 - 转

    项目开发中,我们有时会碰到需要分组排序来解决问题的情况,如:1.要求取出按field1分组后,并在每组中按照field2排序:2.亦或更加要求取出1中已经分组排序好的前多少行的数据 这里通过一张表的示 ...

  3. WebDriver测试EXT控件(基于C#)

    WebDriver测试EXT控件(基于C#)http://www.docin.com/p-748096409.html

  4. 华为 HG8245C 光猫 修改无线用户数限制+hw_ctree.xml 文件解密

    这个操作方法是 从网上其他人提供的方法  和我一个朋友总结出来的,我只是负责整理,并实地在我自己的光猫上操作成功了 风险提示 :刷机有风险,操作需谨慎, 备份备份备份! 俺家,俺的新家是电信光纤接入, ...

  5. [原创]AHA大会回顾

    AHA大会回顾 缘起 AHA之前参加了Daniel的培训,了解到AHA大会,觉得很高大上,开始有些心动.考虑到是工作时间,而且是外地,所以也就停留在心动层面了.之后与伯薇和四正吃饭,听说他们要去参加这 ...

  6. iOS开发中一些常见的并行处理(转)

    本文主要探讨一些常用多任务的最佳实践.包括Core Data的多线程访问,UI的并行绘制,异步网络请求以及一些在运行态内存吃紧的情况下处理大文件的方案等.

其实编写异步处理的程序有很多坑!所以,本文 ...

  7. Java知多少(111)数据库之修改记录

    修改数据表记录也有3种方案. 一.使用Statement对象 实现修改数据表记录的SQL语句的语法是:    update表名 set 字段名1 = 字段值1,字段名2 = 字段值2,……where特 ...

  8. MFC ADO连接Oracle12c数据库 客户端环境搭建

    ADO连接方式一:Provider=MSDAORA.1; 环境配置如下: 去官网下载ODAC121024Xcopy_32bit.zip安装 安装方式如下: (1)解压文件 (2)用命令行CD到该文件的 ...

  9. HMM 自学教程(五)前向算法

    本系列文章摘自 52nlp(我爱自然语言处理: http://www.52nlp.cn/),原文链接在 HMM 学习最佳范例,这是针对 国外网站上一个 HMM 教程 的翻译,作者功底很深,翻译得很精彩 ...

  10. EPANET中的哈希文件——hash.c

    /*-----------------------------------------------------------------------------**   hash.c****   Imp ...