All, i downloaded the nginx-1.22.1.tar.gz from https://nginx.org/en/download.html, and was going to configure the http module of "ngx_http_log_module" for logging analysis purpose, but unfortunately, seems the module does NOT work as i expected.
the original included http modules in the source package are like below:
[root@centos-7-2 nginx-1.22.1]# ls -al src/http/modules/
total 1712
drwxr-xr-x 3 1001 1001 4096 Mar 12 20:24 .
drwxr-xr-x 4 1001 1001 4096 Mar 12 20:24 ..
-rw-r--r-- 1 1001 1001 11866 Oct 19 16:02 ngx_http_access_module.c
-rw-r--r-- 1 1001 1001 6994 Oct 19 16:02 ngx_http_addition_filter_module.c
-rw-r--r-- 1 1001 1001 11742 Oct 19 16:02 ngx_http_auth_basic_module.c
-rw-r--r-- 1 1001 1001 11525 Oct 19 16:02 ngx_http_auth_request_module.c
-rw-r--r-- 1 1001 1001 31112 Oct 19 16:02 ngx_http_autoindex_module.c
-rw-r--r-- 1 1001 1001 19921 Oct 19 16:02 ngx_http_browser_module.c
-rw-r--r-- 1 1001 1001 41078 Oct 19 16:02 ngx_http_charset_filter_module.c
-rw-r--r-- 1 1001 1001 8737 Oct 19 16:02 ngx_http_chunked_filter_module.c
-rw-r--r-- 1 1001 1001 32273 Oct 19 16:02 ngx_http_dav_module.c
-rw-r--r-- 1 1001 1001 6240 Oct 19 16:02 ngx_http_degradation_module.c
-rw-r--r-- 1 1001 1001 5536 Oct 19 16:02 ngx_http_empty_gif_module.c
-rw-r--r-- 1 1001 1001 113329 Oct 19 16:02 ngx_http_fastcgi_module.c
-rw-r--r-- 1 1001 1001 6426 Oct 19 16:02 ngx_http_flv_module.c
-rw-r--r-- 1 1001 1001 22371 Oct 19 16:02 ngx_http_geoip_module.c
-rw-r--r-- 1 1001 1001 44070 Oct 19 16:02 ngx_http_geo_module.c
-rw-r--r-- 1 1001 1001 142741 Oct 19 16:02 ngx_http_grpc_module.c
-rw-r--r-- 1 1001 1001 17038 Oct 19 16:02 ngx_http_gunzip_filter_module.c
-rw-r--r-- 1 1001 1001 29921 Oct 19 16:02 ngx_http_gzip_filter_module.c
-rw-r--r-- 1 1001 1001 8468 Oct 19 16:02 ngx_http_gzip_static_module.c
-rw-r--r-- 1 1001 1001 21700 Oct 19 16:02 ngx_http_headers_filter_module.c
-rw-r--r-- 1 1001 1001 42569 Oct 19 16:02 ngx_http_image_filter_module.c
-rw-r--r-- 1 1001 1001 15036 Oct 19 16:02 ngx_http_index_module.c
-rw-r--r-- 1 1001 1001 20585 Oct 19 16:02 ngx_http_limit_conn_module.c
-rw-r--r-- 1 1001 1001 28816 Oct 19 16:02 ngx_http_limit_req_module.c
-rw-r--r-- 1 1001 1001 49773 Oct 19 16:02 ngx_http_log_module.c
-rw-r--r-- 1 1001 1001 15012 Oct 19 16:02 ngx_http_map_module.c
-rw-r--r-- 1 1001 1001 21205 Oct 19 16:02 ngx_http_memcached_module.c
-rw-r--r-- 1 1001 1001 6794 Oct 19 16:02 ngx_http_mirror_module.c
-rw-r--r-- 1 1001 1001 118391 Oct 19 16:02 ngx_http_mp4_module.c
-rw-r--r-- 1 1001 1001 6976 Oct 19 16:02 ngx_http_not_modified_filter_module.c
-rw-r--r-- 1 1001 1001 142075 Oct 19 16:02 ngx_http_proxy_module.c
-rw-r--r-- 1 1001 1001 8973 Oct 19 16:02 ngx_http_random_index_module.c
-rw-r--r-- 1 1001 1001 26701 Oct 19 16:02 ngx_http_range_filter_module.c
-rw-r--r-- 1 1001 1001 15328 Oct 19 16:02 ngx_http_realip_module.c
-rw-r--r-- 1 1001 1001 17385 Oct 19 16:02 ngx_http_referer_module.c
-rw-r--r-- 1 1001 1001 28370 Oct 19 16:02 ngx_http_rewrite_module.c
-rw-r--r-- 1 1001 1001 61441 Oct 19 16:02 ngx_http_scgi_module.c
-rw-r--r-- 1 1001 1001 9205 Oct 19 16:02 ngx_http_secure_link_module.c
-rw-r--r-- 1 1001 1001 14029 Oct 19 16:02 ngx_http_slice_filter_module.c
-rw-r--r-- 1 1001 1001 6615 Oct 19 16:02 ngx_http_split_clients_module.c
-rw-r--r-- 1 1001 1001 79675 Oct 19 16:02 ngx_http_ssi_filter_module.c
-rw-r--r-- 1 1001 1001 2800 Oct 19 16:02 ngx_http_ssi_filter_module.h
-rw-r--r-- 1 1001 1001 39456 Oct 19 16:02 ngx_http_ssl_module.c
-rw-r--r-- 1 1001 1001 2105 Oct 19 16:02 ngx_http_ssl_module.h
-rw-r--r-- 1 1001 1001 8072 Oct 19 16:02 ngx_http_static_module.c
-rw-r--r-- 1 1001 1001 6094 Oct 19 16:02 ngx_http_stub_status_module.c
-rw-r--r-- 1 1001 1001 26018 Oct 19 16:02 ngx_http_sub_filter_module.c
-rw-r--r-- 1 1001 1001 10833 Oct 19 16:02 ngx_http_try_files_module.c
-rw-r--r-- 1 1001 1001 18728 Oct 19 16:02 ngx_http_upstream_hash_module.c
-rw-r--r-- 1 1001 1001 7555 Oct 19 16:02 ngx_http_upstream_ip_hash_module.c
-rw-r--r-- 1 1001 1001 14923 Oct 19 16:02 ngx_http_upstream_keepalive_module.c
-rw-r--r-- 1 1001 1001 8198 Oct 19 16:02 ngx_http_upstream_least_conn_module.c
-rw-r--r-- 1 1001 1001 12803 Oct 19 16:02 ngx_http_upstream_random_module.c
-rw-r--r-- 1 1001 1001 8644 Oct 19 16:02 ngx_http_upstream_zone_module.c
-rw-r--r-- 1 1001 1001 25004 Oct 19 16:02 ngx_http_userid_filter_module.c
-rw-r--r-- 1 1001 1001 75803 Oct 19 16:02 ngx_http_uwsgi_module.c
-rw-r--r-- 1 1001 1001 29999 Oct 19 16:02 ngx_http_xslt_filter_module.c
drwxr-xr-x 2 1001 1001 126 Mar 12 20:24 perl
but when i was trying to build the nginx package, then run nginx -V to check the installed modules, seems no any module was loaded :
[root@centos-7-2 nginx-1.22.1]# ./configure --prefix=/usr/local/nginx
checking for OS
+ Linux 3.10.0-1160.31.1.el7.x86_64 x86_64
checking for C compiler ... found
+ using GNU C compiler
+ gcc version: 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
........................
.............
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/ngx_modules.o \
objs/ngx_modules.c
cc -o objs/nginx \
objs/src/core/nginx.o \
.....................
objs/src/http/modules/ngx_http_upstream_zone_module.o \
objs/ngx_modules.o \
-ldl -lpthread -lcrypt -lpcre -lz \
-Wl,-E
sed -e "s|%%PREFIX%%|/usr/local/nginx|" \
-e "s|%%PID_PATH%%|/usr/local/nginx/logs/nginx.pid|" \
-e "s|%%CONF_PATH%%|/usr/local/nginx/conf/nginx.conf|" \
-e "s|%%ERROR_LOG_PATH%%|/usr/local/nginx/logs/error.log|" \
< man/nginx.8 > objs/nginx.8
make[1]: Leaving directory `/usr/local/nginx-1.22.1'
# make&make install
make -f objs/Makefile install
make[1]: Entering directory `/usr/local/nginx-1.22.1'
test -d '/usr/local/nginx' || mkdir -p '/usr/local/nginx'
..................
make[1]: Leaving directory `/usr/local/nginx-1.22.1'
[root@centos-7-2 nginx-1.22.1]#
# ./nginx -V
nginx version: nginx/1.22.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
configure arguments: --prefix=/usr/local/nginx
really not sure how to use the original included http modules, the expected http module i want to use is ngx_http_log_module.c, according to the official instruction on page of https://nginx.org/en/docs/http/ngx_http_session_log_module.html, the below directives can NOT be used successfully:
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
session_log one;
}
.......
# ./nginx -t
nginx: [emerg] unknown directive "session_log" in /usr/local/nginx/conf/nginx.conf:47
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
By the way, i have also tried to use the configure parameters of --add-module in ./configure stage, but seems it does NOT work.
thanks for your help in advance.
.....................................