apache-rs 0.0.3

Rust FFI for creating Apache httpd modules.
docs.rs failed to build apache-rs-0.0.3
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: apache-rs-0.0.1

apache-rs

Rust FFI for creating Apache httpd modules.

There is a bundled example implementing mod_example from the Apache httpd documentation: https://httpd.apache.org/docs/2.4/developer/modguide.html.

Setup

bindgen

https://rust-lang.github.io/rust-bindgen/requirements.html

  • Install system packages
sudo apt install llvm-dev libclang-dev clang

Apache httpd

  • Install system packages
sudo apt install apache2-dev libapr1-dev

Build

FFI

  • Build project
cargo build
cargo test --lib

Apache httpd module

  • Build Apache httpd module mod_example
cd examples/mod_example/
cargo build

Test

Locally

  • Install module
cd examples/mod_example/
cargo build
sudo apxs -i -a -n example ./target/debug/libmod_example.so
  • Add module configuration
sudo tee /etc/apache2/mods-enabled/example.conf > /dev/null <<EOT
<IfModule example_module>
    AddHandler example-handler .sum
    <Location "/example">
        SetHandler example-handler
    </Location>
</IfModule>
EOT
  • Restart Apache httpd to load configuration
sudo systemctl restart apache2
  • Navigate to http://localhost/example

Container