Skip to content

Commit

Permalink
Merge pull request #7 from waitspring/NginX
Browse files Browse the repository at this point in the history
update document
  • Loading branch information
waitspring authored Dec 12, 2022
2 parents d4a2e59 + a96c1e4 commit 45c7c0a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
5 changes: 2 additions & 3 deletions NginX/Code/nginx-http-hello-module/ngx_http_hello_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* *
**********************************************************************************************************************
*
* define a command that return string "hello world"
*/

# include <nginx.h>
Expand All @@ -17,9 +18,7 @@ static char *ngx_http_hello(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
static ngx_int_t ngx_http_hello_handler(ngx_http_request_t *r);
static ngx_command_t ngx_http_hello_commands[] = {
{
/* define command "hello" which could be used in nginx.conf
* just return string "hello world"
*/
// define command "hello" which could be used in nginx.conf, return string "hello world".
ngx_string("hello"),
NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LMT_CONF | NGX_CONF_NOARGS,
ngx_http_hello,
Expand Down
17 changes: 9 additions & 8 deletions NginX/Code/nginx-http-hello-module/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@
This demo module is excerpted from
_Understanding NginX Modules Development and Architecture Resolving (Second Edition)_.

### Installation

Build NginX with this directory as a static or dynamic module.
Build NginX with this directory as a static or dynamic module:

```bash
./configure --add-module=/path/to/nginx-http-hello-module
make
make install
$ ./configure --add-module=/path/to/nginx-http-hello-module
$ make
$ make install
```

### Usage
This module could be used in `LOCATION PART` to debug NginX configure file, like:

```bash
```nginx
location ^~ / {
hello;
}
```

Website response is a string `hello world`.

0 comments on commit 45c7c0a

Please sign in to comment.