'Nginx failed test version 1010002 instead of 1012000 in /usr/share/nginx/modules/mod-http-image-filter.conf
Upgraded nginx on a centos 6 test system from 1.10.x to 1.12.x via yum update. I then followed steps to get GeoIP module working (https://tushev.org/articles/linux-bsd/32/using-dynamic-geoip-module-with-nginx-centos).
When I run nginx -t, the following error is displayed:
$ nginx -t
nginx: [emerg] module "/usr/lib64/nginx/modules/ngx_http_image_filter_module.so" version 1010002 instead of 1012000 in /usr/share/nginx/modules/mod-http-image-filter.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed
In my nginx.conf file I commented out the line below
include /usr/share/nginx/modules/*.conf;
and nginx worked as expected again. That's great but doesn't solve my problem. Since this is a dev environment I need to get this working 100%. I am unsure that I really need the image filter after reading the specs (http://nginx.org/en/docs/http/ngx_http_image_filter_module.html).
Further, I did add individual modules back with luck as well:
load_module "modules/ngx_http_geoip_module.so";
I would like to know how to solve the version issue that the error displays and to know if omitting these modules, outside of the one I want, is okay?
Thank you for your time and consideration.
Solution 1:[1]
Posting another solution for people having similar problems, running these following commands worked for me on Centos 7 after I had already configured yum to look to the latest version:
sudo yum remove nginx-mod*
sudo yum install nginx-module-*
Solution 2:[2]
In case Someone face the same problem i invite him to follow these steps to resolve the issues of the compatibility:
before making the module ngx_http_modsecurity_module.so that needed to be load in nginx.conf config file under /etc/nginx/nginx.config.
load_module modules/ngx_http_modsecurity_module.so;
- perform version check against your pre-installed nginx `$ nginx -v`
- download the same version `$ wget http://nginx.org/download/nginx-1.15.10.tar.gz`
- $ tar zxvf nginx-1.15.10.tar.gz
- $ cd nginx-1.15.10
- $ ./configure --with-compat --add-dynamic-module=/path_to_your/modsecurity-nginx-connector
- $ cp objs/ngx_http_modsecurity_module.so /etc/nginx/modules
- add the module to nginx at the beginning of the /etc/nginx/nginx.conf file, after the `user` directive `load_module modules/ngx_http_modsecurity_module.so;`
- $ nginx -t `nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
in my case `nginx version: nginx/1.15.10 `
nginx: configuration file /etc/nginx/nginx.conf test is successful `
and continue the process... as described here nginx.org hope im helpful.
Solution 3:[3]
Rollback to 1.10.2.
nginx: [emerg] module "/etc/nginx/modules/ngx_http_geoip_module.so" version 1010002 instead of 1013002 in /etc/nginx/nginx.conf:12
nginx version: nginx/1.13.2
Solution 4:[4]
I found that I needed to obliterate all the previous nginx-related files rm -rf /etc/nginx and then after another make install everything checked out.
Solution 5:[5]
I just backed up my .conf files then uninstalled and reinstalled nginx and it was fixed.
Solution 6:[6]
my problem here is
sudo nginx -t
2021/07/22 16:54:54 [emerg] 2637399#2637399: module "/usr/lib/nginx/modules/ngx_http_geoip2_module.so" version 1020001 instead of 1020000 in /etc/nginx/nginx.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed
This means my ngx_http_geoip2_module module version is not matched with my Nginx version.
Since I just installed ngx_http_geoip2_module latest version, it must be my Nginx version that needs to update.
Upgrade Nginx version fixed my problem
Solution 7:[7]
Same problem after updating Nginx from version 1.16.1 to 1.20.1:
# yum update nginx
...
Updated:
nginx.x86_64 1:1.20.1-9.el7
Dependency Updated:
nginx-filesystem.noarch 1:1.20.1-9.el7
Complete!
# nginx -t
nginx: [emerg] module "/usr/lib64/nginx/modules/ngx_http_image_filter_module.so" version 1016001 instead of 1020001 in /usr/share/nginx/modules/mod-http-image-filter.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed
Based on the comment of Syd Lambert https://stackoverflow.com/a/58108125/13088275
It is not necessary to delete and reinstall Nginx modules but instead update them:
# yum update nginx*
Updated:
nginx-all-modules.noarch 1:1.20.1-9.el7 nginx-mod-http-image-filter.x86_64 1:1.20.1-9.el7 nginx-mod-http-perl.x86_64 1:1.20.1-9.el7 nginx-mod-http-xslt-filter.x86_64 1:1.20.1-9.el7
nginx-mod-mail.x86_64 1:1.20.1-9.el7 nginx-mod-stream.x86_64 1:1.20.1-9.el7
Complete!
After updating all Nginx modules, Nginx test was successful and I can safe reload Nginx.
# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# nginx -s reload
So the best way to update Nginx is to use the command yum update nginx*.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Syd Lambert |
| Solution 2 | CoperNeq |
| Solution 3 | hun lin |
| Solution 4 | Randy L |
| Solution 5 | Noah Sparks |
| Solution 6 | Steven Shi |
| Solution 7 | Ovidiu Morariu |
