Modules in Depth
NGINX modules act as either handlers, filters or load-balancers
Components
Config Structs
typedef struct {
ngx_uint_t methods;
ngx_flag_t create_full_put_path;
ngx_uint_t access;
} ngx_http_hello_world_loc_conf_t;Directives
static ngx_command_t ngx_http_hello_world_commands[] = {
{
ngx_string("hello_world"), /* directive */
NGX_HTTP_LOC_CONF|NGX_CONF_NOARGS, /* location context and takes no arguments*/
ngx_http_hello_world_commands_set_method, /* configuration setup function */
NGX_RS_HTTP_LOC_CONF_OFFSET,
0, /* No offset when storing the module configuration on the struct. */
NULL
},
...
ngx_null_command // termination
};#[no_mangle]
static mut ngx_http_hello_world_commands: [ngx_command_t; 2] = [
ngx_command_t {
name: ngx_string!("hello_world"),
type_: (NGX_HTTP_LOC_CONF| NGX_CONF_NOARGS) as ngx_uint_t,
set: Some(ngx_http_hello_world_commands_set_method),
conf: NGX_RS_HTTP_LOC_CONF_OFFSET,
offset: 0,
post: std::ptr::null_mut(),
},
ngx_null_command!(), // termination
];Context
Definition
Last updated