nginx启动报错:ngx_http_image_filter_module.so" version 1016001 instead of 1022001 解决办法
问题现象,启动nginx,提示版本不对
[root@k8s-test-node2 modules]# /data/nginx/sbin/nginx
nginx: [emerg] module "/usr/lib64/nginx/modules/ngx_http_image_filter_module.so" version 1016001 instead of 1022001 in /usr/share/nginx/modules/mod-http-image-filter.conf:1
进入配置目录,查看配置文件,分别都加载了5个文件
[root@k8s-test-node2 modules]# cd /usr/share/nginx/modules/ [root@k8s-test-node2 modules]# grep so * mod-http-image-filter.conf:load_module "/usr/lib64/nginx/modules/ngx_http_image_filter_module.so"; mod-http-perl.conf:load_module "/usr/lib64/nginx/modules/ngx_http_perl_module.so"; mod-http-xslt-filter.conf:load_module "/usr/lib64/nginx/modules/ngx_http_xslt_filter_module.so"; mod-mail.conf:load_module "/usr/lib64/nginx/modules/ngx_mail_module.so"; mod-stream.conf:load_module "/usr/lib64/nginx/modules/ngx_stream_module.so"; [root@k8s-test-node2 modules]#
提取5个文件,找到各自生成的nginx 编码命令代码
mod-http-image-filter --with-http_image_filter_module=dynamic ngx_http_perl_module --with-http_perl_module=dynamic ngx_http_xslt_filter_module --with-http_xslt_module=dynamic ngx_mail_module --with-mail=dynamic ngx_stream_module --with-stream=dynamic
下载nginx 1.22.1 版本源码
编译源码命令
./configure --prefix=/data/nginx-com \ --with-http_image_filter_module=dynamic \ --with-http_perl_module=dynamic \ --with-http_xslt_module=dynamic \ --with-mail=dynamic \ --with-stream=dynamic
编译过程中有各种错误提示
提示:./configure: error: the HTTP image filter module requires the GD library. You can either do not enable the module or install the libraries. 解决方法:yum -y install gd gd-devel 再执行configure命令后提示:perl version: This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi 解决方法:yum -y install perl perl-devel perl-ExtUtils-Embedatom 再执行configure命令后提示:./configure: error: the HTTP XSLT module requires the libxml2/libxslt libraries. You can either do not enable the module or install the libraries. 解决方法:yum -y install libxml2 libxml2-dev libxslt-devel 最终configure 执行成功,再执行make ,make install 命令编译生成二进制文件 [root@k8s-test-node2 modules]# ll /data/nginx-com/modules total 1372 -rwxr-xr-x 1 root root 99336 Feb 20 14:39 ngx_http_image_filter_module.so -rwxr-xr-x 1 root root 129304 Feb 20 14:39 ngx_http_perl_module.so -rwxr-xr-x 1 root root 110120 Feb 20 14:39 ngx_http_xslt_filter_module.so -rwxr-xr-x 1 root root 375992 Feb 20 14:39 ngx_mail_module.so -rwxr-xr-x 1 root root 682976 Feb 20 14:39 ngx_stream_module.so
把这结果so文件,复制到目录下:/usr/lib64/nginx/modules/
再执行:/data/nginx/sbin/nginx -t 提示OK
[root@k8s-test-node2 sbin]# /data/nginx/sbin/nginx -t nginx: the configuration file /data/nginx/conf/nginx.conf syntax is ok nginx: configuration file /data/nginx/conf/nginx.conf test is successful [root@k8s-test-node2 sbin]#