headers-more-nginx-module
headers-more-nginx-module copied to clipboard
Does this module work with nginx 1.22.0
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?
Did you recompile the headers-more-nginx-modules?
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.
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
Many thanks, @zhuizhuhaomeng . Appreciate it!
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?
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.
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?
use the nginx -V to get the configuration of the running nginx, and then
add --add-dynamic-module=../nginx-upload-module to the original
configuration
Anjali Raj @.***> 于2023年7月4日周二 14:29写道:
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 /objs/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?
— Reply to this email directly, view it on GitHub https://github.com/openresty/headers-more-nginx-module/issues/146#issuecomment-1619580683, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6RHPTWNGVZDMIVEFI46W3XOOZ5FANCNFSM6AAAAAAZAI277Q . You are receiving this because you were mentioned.Message ID: @.***>
@zhuizhuhaomeng Running the configure command for the required modules with the original configuration is also giving the same error.
would you please show the process of how you compile the nginx module?
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?
what is the value of nginx -V in photon VM?
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.
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
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.