Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dcoles/nginx-rs
Nginx module written in Rust
https://github.com/dcoles/nginx-rs
nginx nginx-modules rust
Last synced: about 2 months ago
JSON representation
Nginx module written in Rust
- Host: GitHub
- URL: https://github.com/dcoles/nginx-rs
- Owner: dcoles
- License: mit
- Archived: true
- Created: 2019-10-06T18:14:29.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-11-08T04:34:48.000Z (about 1 year ago)
- Last Synced: 2024-11-15T04:14:24.209Z (2 months ago)
- Topics: nginx, nginx-modules, rust
- Language: Rust
- Size: 44.9 KB
- Stars: 88
- Watchers: 6
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nginx-rs
[![crates.io](https://img.shields.io/crates/v/nginx-rs.svg)](https://crates.io/crates/nginx-rs)
[![MIT License](https://img.shields.io/crates/l/nginx-rs.svg)](LICENSE)> **Note**
> **[Nov 2023]** Nginx now provides official Rust support with the [`ngx`](https://crates.io/crates/ngx) crate.
>
> See Nginx's blog post [*Extending NGINX with Rust (an Alternative to C)*](https://www.nginx.com/blog/extending-nginx-with-rust-an-alternative-to-c/).
>
> **[Feb 2023]** I haven't had a chance to work on this recently, but you might be interested in
> Cloudflare's blog post [*ROFL with a LOL: rewriting an NGINX module in Rust*](https://blog.cloudflare.com/rust-nginx-module/), which takes some inspiration from this module.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.## Building Modules
Building modules requires a checkout of the Nginx sources
[configured for building dynamic modules](https://www.nginx.com/blog/compiling-dynamic-modules-nginx-plus/):```bash
export NGINX_DIR=/path/to/nginx
cd "${NGINX_DIR}"
auto/configure --with-compat
```Once Nginx is configured, you can then build your module:
```bash
cd /path/to/module
cargo build --release
```The resulting `.so` in `target/release` can then be loaded using the
[`load_module` directive](https://nginx.org/en/docs/ngx_core_module.html#load_module).## Examples
- [hello_world](/examples/hello_world) — Demonstrations access control and content handlers
## Licence
This project is licensed under the terms of the [MIT license](LICENSE).