NGINX can load a Rust-backed HTTP handler as a dynamic module. A small C layer supplies module initialization, while Rust provides the handler implementation. section 4.2
A practical integration workflow is:
- Download NGINX 1.19.3 and create a Cargo library crate. section 4.1
- Create a module configuration script and C starter file with HTTP hooks and a calculation directive. section 4.2
- Configure NGINX with the module, build the module and binary, then load the resulting shared object. section 4.2
- Run the server with a location such as /calculate and enable the module through nginx.conf. section 4.2
$ cargo new --lib ngx_http_calculator_rs $ cd ngx_http_calculator_rs $ wget https://nginx.org/download/nginx-1.19.3.tar.gz $ tar -xfz nginx-1.19.3.tar.gz
Use the command listing to create the crate, download the NGINX source, and extract the release archive. section 4.1


