Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Server \ Nginx version of helloworld     - HBase Application Development Review and Summary of Series (Database)

- Monitoring Linux System 7 command-line tool (Linux)

- Android Service service applications and the phone SMS Listener Listener (Programming)

- Go powerful development server simple example (Server)

- GO five stages of language learning (Programming)

- ImageMagick Tutorial: How to cut images in Linux command line (Linux)

- Installation and configuration of phpMyAdmin under CentOS (Database)

- Java implementation file encryption and decryption (Programming)

- How to Install Puppet in the Ubuntu 15.04 (Server)

- Create a project using Android Studio LinearLayout (Programming)

- Java loop list to solve the problem of Joseph ring (Programming)

- The best tools and techniques to find data on a Unix system (Linux)

- Use small network command to check whether PC Security (Linux)

- Log4Net (Linux)

- MySQL loose index scan (Database)

- How to monitor Linux system performance Nmon (Linux)

- Oracle Linux 6.4 installed Oracle 11gR2 + RAC + ASM (Database)

- Linux operating system security settings initial understanding (Linux)

- Intrusion prevention network server security maintenance tips (Linux)

- CentOS7 installation GAMIT and GMT (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".
- Remove old kernel on Ubuntu (Linux)
- Oracle 11g RAC automatically play GI PSU patch ( (Database)
- Realization of Linux operating system illegal IP censorship (Linux)
- Btrfs file system creation and their characteristics in Linux (Linux)
- The hash function under OpenSSL (Linux)
- Matters Oracle 11.2 single instance when connecting ASM need to pay attention and deal with the problem (Database)
- Linux settings Java_home (Linux)
- Binder began to talk about inter-process communication mechanism from Android AIDL (Programming)
- Recover accidentally deleted Nginx logs (Server)
- ORA-600 [kcbz_check_objd_typ] Error Handling (Database)
- Build their own recursive DNS server (Server)
- STL spatial Configurator (Programming)
- Linux system security settings (Linux)
- CentOS terminal display Chinese (Linux)
- Linux operating system, the internal and external security overview (Linux)
- Linux Powerful IDE - Geany configuration instructions (Linux)
- OpenSSH server configuration file for each Common Definition (Server)
- Distributed transaction management Spring declarative transactions (Programming)
- Git you do not know about some of the things (Linux)
- How to display a dialog Bash Shell script (Programming)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.