百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
N

nginx-http-echo-module

> DevOps
开源

一个简单的 Nginx echo 模块

199 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

一个简单的 Nginx echo 模块

Practical development Nginx Module

简体中文

nginx_module_echo

echo string

Nginx Version

Nginx1.0.10 https://github.com/nginx/nginx/releases/tag/release-1.0.10

The development environment configuration

bash
OS : CentOS Linux release 7.2.1511 (Core)

Install a clean compile Nginx

  1. Download a Nginx10.10 and unpack it

  2. Install the GCC and the lib Nginx need

  3. ./configure --prefix=/usr/local/nginx && make && make install

  4. Nginx run

Definition module configuration structure

c
typedef struct {
    ngx_str_t ed;  //该结构体定义在这里 https://github.com/nginx/nginx/blob/master/src/core/ngx_string.h
} ngx_http_echo_loc_conf_t;

Define Nginx instruction and parameter conversion function

definition module Context

  1. Define the type of ngx_http_module_t structure variables

  2. Initialize a configuration structure

  3. Will the father block configuration information incorporated into this structure Implement the configuration of inheritance

Write the Handler really work part of the module

Combination Nginx module

Finishing module code According to the Nginx official specification

Write the config file

bash
ngx_addon_name=ngx_http_echo_module
HTTP_MODULES="$HTTP_MODULES ngx_http_echo_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/src/ngx_http_echo_module.c"

make && make install

bash
 ./configure --prefix=/usr/local/nginx/ --add-module=/root/ngx_dev && make && make install

Successful installation

Modify the Nginx configuration file test Module

Nginx echo Module The successful running

If the repo help you welcome star fork Thanks!

reference

  1. http://wiki.nginx.org/Configuration
  2. http://tengine.taobao.org/book/
  3. http://blog.codinglabs.org/articles/intro-of-nginx-module-development.html
  4. https://www.nginx.com/resources/wiki/modules/

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ccgccnginxnginx-echo

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类DevOps
定价开源

> 相关工具

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理