提交 e4a20a6f 编写于 作者: W Wu Jian Ping

优化代码

上级 bdc22baa
...@@ -15,16 +15,16 @@ $ make install ...@@ -15,16 +15,16 @@ $ make install
... ...
http { http {
log_format json_access_log escape=json '{' log_format main escape=json '{'
'"remote_addr": "$remote_addr", ' '"remote_addr": "$remote_addr", '
'"region": "$ip2region", ' '"region": "$ip2region", '
'"http_x_forwarded_for": "$http_x_forwarded_for"' '"http_x_forwarded_for": "$http_x_forwarded_for"'
'}'; '}';
access_log logs/access.log json_access_log; access_log logs/access.log main;
# 设置xdb文件路径 # 设置xdb文件路径
ip2region ip2region.xdb; ip2region_db ip2region.xdb;
server { server {
listen 80; listen 80;
......
ngx_addon_name=ngx_ip2region_module ngx_addon_name=ngx_http_ip2region_module
NGX_IP2REGION_SRCS=" \ NGX_HTTP_IP2REGION_SRCS=" \
$ngx_addon_dir/src/ngx_http_ip2region_module.c \ $ngx_addon_dir/src/ngx_http_ip2region_module.c \
$ngx_addon_dir/src/xdb_searcher.c \ $ngx_addon_dir/src/xdb_searcher.c \
" "
NGX_IP2REGION_DEPS=" \ NGX_HTTP_IP2REGION_DEPS=" \
" "
HTTP_MODULES="$HTTP_MODULES ngx_http_ip2region_module" if test -n "$ngx_module_link"; then
# STREAM_MODULES="ngx_stream_ip2region_module $STREAM_MODULES" ngx_module_type=HTTP
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $NGX_IP2REGION_SRCS" ngx_module_name=$ngx_addon_name
NGX_ADDON_DEPS="$NGX_ADDON_DEPS $NGX_IP2REGION_DEPS" ngx_module_deps="$NGX_HTTP_IP2REGION_DEPS"
ngx_module_srcs="$NGX_HTTP_IP2REGION_SRCS"
. auto/module
else
HTTP_MODULES="$HTTP_MODULES $ngx_addon_name"
NGX_ADDON_DEPS="$NGX_ADDON_DEPS $NGX_HTTP_IP2REGION_DEPS"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $NGX_HTTP_IP2REGION_SRCS"
fi
\ No newline at end of file
...@@ -29,7 +29,7 @@ static ngx_http_module_t ngx_http_ip2region_ctx = { ...@@ -29,7 +29,7 @@ static ngx_http_module_t ngx_http_ip2region_ctx = {
static ngx_command_t ngx_http_ip2region_commands[] = { static ngx_command_t ngx_http_ip2region_commands[] = {
{ ngx_string("ip2region"), { ngx_string("ip2region_db"),
NGX_HTTP_MAIN_CONF | NGX_CONF_TAKE12, NGX_HTTP_MAIN_CONF | NGX_CONF_TAKE12,
ngx_http_ip2region_init, ngx_http_ip2region_init,
NGX_HTTP_MAIN_CONF_OFFSET, NGX_HTTP_MAIN_CONF_OFFSET,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册