I'm trying to create a simple nginx module on MacOS which redirects calls from port 8080 to port 44444 and when the value of a specific header is "reverse" it reverses the content of the "text" field ("hello" becomes "olleh")
I have downloaded nginx source files (I've tried this both with nginx 1.29 and 1.14) and I've structured my folders like this:
my home -> nginx-tests ->
my future module folder containing both the config file and the .c
the nginx 1.14 or 1.29 source folder
the pcre source file (I had to include it to not get a error)
So I positioned myself inside the source folder and used the "make clean" command, followed by
./configure --with-compat \
--add-dynamic-module=/Users/myUser/nginx-tests/nginx-mymodule \
--with-pcre=/Users/myUser/nginx-tests/pcre-8.45
Then I tried using the "make modules" command, which prompted that there was no change to be done.
So I tried using the "make" command. This one generated the .o of my module into a folder in objs
To generate the .so the only solution I've found was to use this command
clang -dynamiclib -o objs/ngx_http_mymodule_module.so \
objs/addon/nginx-mymodule/ngx_http_mymodule_module.o \
-undefined dynamic_lookup
and that works, generating the .so in objs
After generating the .so I've used "make install" to install nginx in my usr/local folder and added the modules folder with the generated .so into it.
In the nginx.conf I've referenced it using load_module + the path to my .so file
However when launching nginx I get prompted with the message "symbol not found" concerning my module.
What am I doing wrong?