Coder Social home page Coder Social logo

nginx-http-echo-module's Introduction

Practical development Nginx Module

Build Status

nginx_module_echo

echo string

Nginx Version

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

The development environment configuration

OS : CentOS Linux release 7.2.1511 (Core)

Server_info.png Server_CPU_info.png

Install a clean compile Nginx

  1. Download a Nginx10.10 and unpack it nginx1.0.10.png

  2. Install the GCC and the lib Nginx need install_GCC.png Nginx_lib.png

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

  4. Nginx run start_nginx.png nginx_install_ok.png

Definition module configuration structure

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_moudle_conf.png

Define Nginx instruction and parameter conversion function

定义指令和参数转化函数.png

definition module Context

  1. Define the type of ngx_http_module_t structure variables 定义注入点结构体.png
  2. Initialize a configuration structure 初始化一个配置结构体.png
  3. Will the father block configuration information incorporated into this structure Implement the configuration of inheritance 合并父block的配置信息.png

Write the Handler really work part of the module

Nginx模块handler.png

Combination Nginx module

组合Nginx Module.png

Finishing module code According to the Nginx official specification

ok_file.png

Write the config file

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

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

Successful installation

make install.png

Modify the Nginx configuration file test Module

test module.png

Nginx echo Module The successful running

module ok.png

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/

nginx-http-echo-module's People

Contributors

wujunze avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nginx-http-echo-module's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.