A framework for writing Nginx modules in pure Rust.
This module is in early stages. It lacks documentation and the API is still quite unstable. But it can be used to write simple request handlers for content or access control.
Heavily copying things from:
Building modules requires a checkout of the Nginx sources. If no path is provided it will download nginx and configure it for you using the version specified with env NGINX_VERSION
.
configured for building dynamic modules:
export NGINX_PATH=/path/to/nginx
cd "${NGINX_PATH}"
auto/configure --with-compat
Once Nginx is configured, you can then build your module:
cd /path/to/module
NGINX_PATH=/path/to/nginx cargo build --release
Or you can build the module letting the library download and configure nginx:
cd /path/to/module
NGINX_VERSION=1.19.10 cargo build --release
The resulting .so
in target/release
can then be loaded using the
load_module
directive.
- hello_world — Demonstrations access control and content handlers
- clean up code
- improve docs
- not sure about the derives for the commands config so think about that
- remove lots of
unsafe
calls - add more features (mail, event)
- add more examples
- implement for static library compiled with nginx
- make it work on mac / windows
- add tests
- use Box for complex value?
- document slots macros
- move need for
*mut NgxComplexValue
- improve merge logic
- simplify how commands are constructed
- remove need for const offset
- remove http_proxy definitions from c wrapper
- make cache purge example less bad
- find and fix all the bugs I have no idea are there
- add more bugs
nginxinc/ngx-rust is licensed under Apache License and nginxinc/ngx-rust is licensed under MIT license so I have no idea which to put here. Might revise when this is more stable / usable.