#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
static char *ngx_http_mytest(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
static void *ngx_http_mytest_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_mytest_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child);
typedef struct {
ngx_str_t str;
}ngx_http_mytest_loc_conf_t;
static ngx_command_t ngx_http_mytest_commands[] = {
{
ngx_string("mytest"),
NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ngx_http_mytest,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_mytest_loc_conf_t, str),
NULL
},
ngx_null_command
};
static ngx_http_module_t ngx_http_mytest_module_ctx = {
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
ngx_http_mytest_create_loc_conf,
Nginx模块开发:自定义模块hello world
最新推荐文章于 2024-09-19 16:00:00 发布
本文介绍了如何开发一个简单的Nginx自定义模块,通过配置nginx.conf并设置访问路径,当浏览器访问特定URL时,返回'just for fun!'的响应,展示自定义模块的基本使用。
摘要由CSDN通过智能技术生成