ps:端口改变文件 安装目录的 ...(安装目录).../conf/nginx.comf中1: ./configure --prefix=/usr/local/notifyServer/ --add-module=/usr/local/src/nginx_notifyserver_module
#-prefix=/usr/local/notifyServer/ 表示安装路径
在 /usr/local/src/nginx_notifyserver_module 中会有对应config文件以及C文件。
如:
#config
ngx_addon_name=ngx_notifyserver_module
HTTP_MODULES="$HTTP_MODULES ngx_http_notifyserver_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_notifyserver_module.c"
CORE_LIBS="$CORE_LIBS -lnotifyserver"
#ngx_http_notifyserver_module.c
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
#include <iconv.h>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
#include "idm_service.h"
#define OUT_BUFSIZE 20480
#define IN_BUFSIZE 2048
#define CHAR_BUFSIZE 128
#define ERR_BUFSIZE 4096
typedef unsigned char BYTE;
static char *ngx_http_notifyserver_set(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
static ngx_int_t ngx_http_notifyserver_init_master(ngx_log_t *log);
static ngx_int_t ngx_http_notifyserver_init_module(ngx_cycle_t *cycle);
static ngx_int_t ngx_http_notifyserver_init_process(ngx_cycle_t *cycle);
static ngx_int_t ngx_http_notifyserver_init_thread(ngx_cycle_t *cycle);
static void ngx_http_notifyserver_exit_thread(ngx_cycle_t *cycle);
static void ngx_http_notifyserver_exit_process(ngx_cycle_t *cycle);
static void ngx_http_notifyserver_exit_master(ngx_cycle_t *cycle);
static ngx_int_t make_http_header(ngx_http_request_t *r);
static ngx_int_t make_http_get_body(ngx_http_request_t *r, char *out_buf);
2:在安装目录中的 ..(安装目录).../obj/Makfile中添加对应编译代码
如:
objs/addon/nginx_notifyserver_module/ngx_http_notifyserver_module.o \
objs/ngx_modules.o
...
objs/addon/nginx_notifyserver_module/ngx_http_notifyserver_module.o \
...
-lpthread -lcrypt -lnotifyserver -lpcre -lcrypto -lcrypto -lz # 添加.c文件依赖的库
...
objs/addon/nginx_notifyserver_module/ngx_http_notifyserver_module.o: $(ADDON_DEPS) \
/usr/local/src/nginx_notifyserver_module/ngx_http_notifyserver_module.c
$(CC) -c $(CFLAGS) $(ALL_INCS) \
-o objs/addon/nginx_notifyserver_module/ngx_http_notifyserver_module.o \
/usr/local/src/nginx_notifyserver_module/ngx_http_notifyserver_module.c
3:make
make install(如果是已经安装的,则去掉make install)
总结:顺序上应该是先make,在./configure