Skip to content
A hello world module for learning Nginx module development
Branch: master
Clone or download
perusio Merge pull request #5 from daneshvar/master
* Fixed and tested with nginx/1.14.2.
Latest commit 4bd17ea Mar 5, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information. Dynamic module configuration Mar 1, 2019
config Converting a config file to the new-style Mar 1, 2019
ngx_http_hello_world_module.c Fix response Mar 1, 2019

Hello World Module for Nginx


This module serves as a learning exercise for me, and hopefully for others too, when doing Nginx module development.

I stole the code and added some notes using mostly Evan Miller's Nginx Module Development Guide. Also helpful is the translation of Vhalery Kholodov's Nginx Module Guide done by Antoine Bonavita that also mantains a Nginx Discovery blog to document his journey on Nginx module development.


  1. Configure Nginx adding this module with:

    Static Module : ./configure (...) --add-module=/path/to/nginx-hello-world-module
    Dynamic Module: ./configure (...) --add-dynamic-module=/path/to/nginx-hello-world-module
  2. Build Nginx as usual with make.

  3. Configure the module. There's only one directive hello_world that is supported in the location context only.


    location = /test {

    Now doing something like:

    curl -i

    should return the hello world string as the response body.

Further reading

  • English: You can go to the Nginx Planet and get a lot of Nginx related information.

  • Russian: The Habrahabr Nginx Blog a treasure trove of Nginx related discussions. Use google translate or Babelfish if you don't read Russian.


  1. Add an argument to the hello_world directive specifying the language. For example:

    • en: hello world

    • fr: bounjour monde

    • pt: olá mundo

    • es: hola mundo

  2. Make the hello_world directive be also defined in the if in location context (NGX_HTTP_LIF_CONF) in ngx_http_config.h. Which implies defining a merge configuration function.

  3. Document everything with Doxygen linking the relevant header and source files from the Nginx core.

You can’t perform that action at this time.