Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Server \ Nginx version of helloworld     - Loop arrays in C language is not easy to find a bug (Programming)

- osprofiler use OpenStack Cinder Lane (Server)

- Windows Ubuntu dual system a key Ghost, grub rescue prompt solution (Linux)

- Linux raw socket (Programming)

- Redis performance test (Database)

- CentOS 6.5 installation and simple configuration Nginx (Server)

- Linux (SUSE) mount NTFS mobile hard practice (Linux)

- Use rfkill soft-switching and Bluetooth wireless capabilities in Linux (Linux)

- Detailed driver compiled into the Linux kernel (Programming)

- Linux system performance and usage activity monitoring tools -Sysstat (Linux)

- Zypper command for SUSE Linux package management (Linux)

- Linux Programming memory mapping (Programming)

- MySQL 5.7.10 source code for the latest version of the installation process in detail (Database)

- The difference Docker save and export commands (Linux)

- Oracle Database Delete Delete million or more common method of heap table data (Database)

- SecureCRT 7.0 Log Ubuntu 12.04 server via SSH service under Vmware (Server)

- Shell Scripting Basics (Linux)

- Linux text processing tool of sed (Linux)

- Kali Linux 2.0 U disk installation errors Your installation cd-rom could not be mounted (Linux)

- Cacti monitoring service Nginx (Linux)

  Nginx version of helloworld
  Add Date : 2018-11-21      
  Nginx Module Overview
Nginx modules that can not be dynamically added as Apache, all modules must be pre-compiled into Nginx binary executable file.
Nginx modules have three roles:
(1) Handlers (processing module) - for handling HTTP requests and output.
(2) Filters (filter modules) - for filtering content Headler output.
(3) Load-balancers (load balancing module) - When more than one server available, select a back-end server and forwards the request to the HTTP server.

hello world module prepared and Installation
(1) Execute the following commands to prepare our Nginx modules in that directory:

mkdir -p / opt / nginx_hello_world
cd / opt / nginx_hello_world

(2) needed to start creating nginx module configuration file (named config)
vim / opt / nginx_hello_world
Then enter the following to save and exit:

ngx_sddon_name = nginx_http_hello_world_module
HTTP_MODULES = "$ HTTP_MODULES ngx_http_hello_world_module"
NGX_ADDON_SRCS = "$ NGX_ADDON_SRCS $ ngx_addon_dir / ngx_http_hello_world_module.c"
CORE_LIBS = "$ CORE_LIBS -lpcre"

(3) create a Nginx module c program file (format "ngx_http_ module name _module.c", in this case: ngx_http_hello_world_module.c)
vim /opt/nginx_hello_world/ngx_http_hello_world_module.c

#include < ngx_config.h>
#include < ngx_core.h>
#include < ngx_http.h>

static char * ngx_http_hello_world (ngx_conf_t * cf, ngx_command_t * cmd, void * conf);

static ngx_command_t ngx_http_hello_world_commands [] = {
ngx_string ( "hello_world"),

static u_char ngx_hello_world [] = "hello world";
static ngx_http_module_t ngx_http_hello_world_module_ctx = {



ngx_module_t ngx_http_hello_world_module = {
& Ngx_http_hello_world_module_ctx,

static ngx_int_t ngx_http_hello_world_handler (ngx_http_request_t * r)
ngx_buf_t * b;
ngx_chain_t out;

r-> headers_out.content_type.len = sizeof ( "text / plain") - 1;
r-> headers_out.content_type.data = (u_char *) "text / plain";

b = ngx_pcalloc (r-> pool, sizeof (ngx_buf_t));

out.buf = b;
out.next = NULL;

b-> pos = ngx_hello_world;
b-> last = ngx_hello_world + sizeof (ngx_hello_world);
b-> memory = 1;
b-> last_buf = 1;

r-> headers_out.status = NGX_HTTP_OK;
r-> headers_out.content_length_n = sizeof (ngx_hello_world);
ngx_http_send_header (r);

return ngx_http_output_filter (r, & out);
static char * ngx_http_hello_world (ngx_conf_t * cf, ngx_command_t * cmd, void * conf)
{Ngx_http_core_loc_conf_t * clcf;
clcf = ngx_http_conf_get_module_loc_conf (cf, ngx_http_core_module);
clcf-> handler = ngx_http_hello_world_handler;
return NGX_CONF_OK;


(4) that refer to my nginx install Nginx install a blog in this step is slightly different
**. / Configure -prefix = / usr / local / nginx -add-module = / opt / nginx_hello_world
make && make install **

(5) Configuration nginx.conf (/usr/local/nginx/conf/nginx.conf), part of the increase in the server the following:
** Location = / hello {
} **

(6) start Nginx, (Nginx start), the browser to http: // localhost / hello, you can see written Nginx Hello World module outputs the text "hello world".
- Apache POI Excel Document Processing (Linux)
- Unity Greeter Badges: the lost session icon back to the login screen Ubuntu (Linux)
- Android HTTP request with Get Information (Programming)
- Ubuntu Linux installation GAMIT10.6 (Linux)
- Unix system security configuration (Linux)
- wget command examples (Linux)
- 6 common PHP security attacks (Linux)
- Correlation Analysis: FP-Growth algorithm (Programming)
- Detailed installation of CentOS 6.x (Linux)
- C ++ multithreading and critical resource instance (Programming)
- GNU Linux system variables (sysctl configuration commands) integrated use (Linux)
- Three kinds of binary tree traversal recursive and iterative solution (Programming)
- Why you should choose Python Programming (Programming)
- Detailed Linux network security policies and protection measures (Linux)
- MongoDB, Cassandra, HBase transaction design strategy (Database)
- Ubuntu 14.04 compile, install, configure, the latest development version GoldenDict (Linux)
- Linux Fundamentals of the text, data flow processing orders (Linux)
- HTTP Client Hints Introduction (Server)
- How to use the Linux kill command to kill the process / program is not responding (Linux)
- Single Instance ASM under CRS-4124, CRS-4000 error handling (Database)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.