Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does this module work with nginx 1.22.0 #146

Open
martha889 opened this issue Jun 9, 2023 · 15 comments
Open

Does this module work with nginx 1.22.0 #146

martha889 opened this issue Jun 9, 2023 · 15 comments

Comments

@martha889
Copy link

I see the last tested version is nginx 1.21; I recently upgraded the nginx version and have started seeing the error:

nginx: [emerg] module "/etc/nginx/modules/ngx_http_headers_more_filter_module.so" version 1012002 instead of 1022000 in /etc/nginx/nginx.conf:8

How can I resolve this?

@zhuizhuhaomeng
Copy link
Contributor

Did you recompile the headers-more-nginx-modules?

@martha889
Copy link
Author

Thanks for replying @zhuizhuhaomeng . I looked at the instructions:


 wget 'http://nginx.org/download/nginx-1.17.8.tar.gz'
 tar -xzvf nginx-1.17.8.tar.gz
 cd nginx-1.17.8/

 # Here we assume you would install you nginx under /opt/nginx/.
 ./configure --prefix=/opt/nginx \
     --add-module=/path/to/headers-more-nginx-module

 make
 make install

Is it possible to re-compile just the module to generate the .so file without nginx? ̦Please correct me as I'm not familiar with how nginx works.

@zhuizhuhaomeng
Copy link
Contributor

yes, you can recompile just the module.
please add the --with-compat option when compile nginx.

./configure --prefix=/opt/nginx
--add-module=/path/to/headers-more-nginx-module
--with-compat

@martha889
Copy link
Author

Many thanks, @zhuizhuhaomeng . Appreciate it!

@RajAnjali
Copy link

Compiling with the --with-combat option using ./configure --with-compat --add-dynamic-module=../headers-more-nginx-module , I'm getting the following error:

nginx: [emerg] module "/etc/nginx/modules/ngx_http_headers_more_filter_module.so" is not binary compatible in /etc/nginx/nginx.conf:4

Is there a way to resolve this issue?

@MushyMiddle
Copy link

MushyMiddle commented Jun 28, 2023

I have the same issue with nginx 1.18.0 (the version in Ubuntu 20.04 LTS), and the latest version in the nginx repo - 1.24.0. Compiled with source from both releases, same error as above when trying to load it.

But, at least for nginx 1.24.0, adding --with-compat seems to have solved it for me. Did not try that on 1.18.0 - yet.

FYI, in my case, I want to use packaged nginx, so did make modules to build vs. make/make install.

Edit: Works on 1.18.0 using --with-compat as well.

@RajAnjali
Copy link

RajAnjali commented Jul 4, 2023

I'm facing the same issue with another module as well. I'm trying to build the ngx_http_upload_module from source code using the following commands.

tdnf -y install wget git pcre-devel
wget http://nginx.org/download/nginx-1.22.0.tar.gz
tar -xvf nginx-1.22.0.tar.gz 
git clone https://github.com/vkholodkov/nginx-upload-module 
cd nginx-1.22.0/
./configure --with-compat --add-dynamic-module=../nginx-upload-module 
make modules
cd objs
cp ngx_http_upload_module.so /etc/nginx/modules

This is output of nginx -t

nginx: [emerg] module "/etc/nginx/modules/ngx_http_upload_module.so" is not binary compatible in /etc/nginx/nginx.conf:6
nginx: configuration file /etc/nginx/nginx.conf test failed

I tried with make and make install instead of make modules as well. In that case also, same error as mentioned above.

I need to compile ngx_http_headers_more_filter_module and ngx_http_headers_more_filter_module for Nginx 1.22.0.
Since I'm facing the same issue for two different modules, I suspect that the issue is in the way we are generating the .so files which is causing issues.

Can anyone please confirm this and help in resolving the issue?

@zhuizhuhaomeng
Copy link
Contributor

zhuizhuhaomeng commented Jul 4, 2023 via email

@RajAnjali
Copy link

@zhuizhuhaomeng Running the configure command for the required modules with the original configuration is also giving the same error.

@zhuizhuhaomeng
Copy link
Contributor

would you please show the process of how you compile the nginx module?

@RajAnjali
Copy link

Sure, the following set of commands are working fine in ubuntu 22.04 but seems to be failing in PhotonOS 4.0

root@ubuntu22:~# wget http://nginx.org/download/nginx-1.22.0.tar.gz
root@ubuntu22:~# tar xvzf nginx-1.22.0.tar.gz 

root@ubuntu22:~# git clone https://github.com/openresty/headers-more-nginx-module.git
root@ubuntu22:~# git clone https://github.com/vkholodkov/nginx-upload-module 

root@ubuntu22:~# cd nginx-1.22.0
root@ubuntu22:~/nginx-1.22.0# ./configure --with-compat --add-dynamic-module=../nginx-upload-module --add-dynamic-module=../headers-more-nginx-module
root@ubuntu22:~/nginx-1.22.0# make modules

root@ubuntu22:/etc/nginx# nginx -t
nginx: [emerg] dlopen() "/etc/nginx/modules/ngx_http_headers_more_filter_module.so" failed (/etc/nginx/modules/ngx_http_headers_more_filter_module.so: cannot open shared object file: No such file or directory) in /etc/nginx/nginx.conf:11
nginx: configuration file /etc/nginx/nginx.conf test failed

root@ubuntu22:~/nginx-1.25.1# cp objs/ngx_http_headers_more_filter_module.so /etc/nginx/modules
root@ubuntu22:~/nginx-1.25.1# cp objs/ngx_http_upload_module.so /etc/nginx/modules

root@ubuntu22:~/nginx-1.25.1# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

I copied the so files generated in ubuntu VM to photon VM and still getting "binary not compatible" error.

Is there a way to generate the so files which are compatible with PhotonOS 4.0?

@zhuizhuhaomeng
Copy link
Contributor

what is the value of nginx -V in photon VM?

@zhuizhuhaomeng
Copy link
Contributor

You'd better to compile ngx-headers-more on PhotonOS 4.0.
Build on ubuntu and then copy to the PhotonOS 4.0 is not a good idea.

@RajAnjali
Copy link

Right, so when I'm trying in PhotonOS 4.0 using the same commands, then also the generated binary is not compatible. I've tried with Nginx 1.19.3 and 1.22.0.

Output of nginx -V:

nginx version: nginx/1.22.0
built by gcc 10.2.0 (GCC) 
built with OpenSSL 3.0.7 1 Nov 2022
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --add-module=njs-0.7.5/nginx --with-http_ssl_module --with-pcre --with-ipv6 --with-stream --with-http_auth_request_module --with-http_sub_module --with-http_stub_status_module --with-http_v2_module --with-http_realip_module --user=nginx --group=nginx

@RajAnjali
Copy link

In the Photon VM, there was residual configuration which was causing the "binary not compatible" issue.
Running make clean before the ./configure and make modules command resolved the issue.

Thanks for the help @zhuizhuhaomeng.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants