Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nginx1.19.4 reload时报 [emerg] 939#939: unknown directive "check" in /data/app/nginx/conf/upstream.conf:108 #269

Open
dengliyao opened this issue Jun 2, 2023 · 1 comment

Comments

@dengliyao
Copy link

编译前执行如下patch
[root@pro-zdb-nginx01-NEW objs]# patch -p1 < /usr/local/src/nginx-1.19.4/nginx_upstream_check_module-0.4.0/check_1.16.1+.patch

已正确编译加入模块nginx参数如下
nginx version: nginx/1.19.4
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/data/app/nginx --with-threads --with-stream --with-stream_ssl_preread_module --with-stream_ssl_module --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_perl_module --with-http_sub_module --with-http_flv_module --with-http_mp4_module --with-file-aio --with-http_v2_module --with-pcre --without-http_upstream_keepalive_module --add-module=/usr/local/src/nginx-1.19.4/nginx_upstream_check_module-0.4.0

编译时如下
configuring additional modules
adding module in /usr/local/src/nginx-1.19.4/nginx_upstream_check_module-0.4.0
checking for ngx_http_upstream_check_module ... found

  • ngx_http_upstream_check_module was configured
    checking for PCRE library ... found
    checking for PCRE JIT support ... found
    checking for OpenSSL library ... found
    checking for zlib library ... found
    checking for perl
  • perl version: This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi
  • perl interpreter multiplicity found
    creating objs/Makefile

Configuration summary

  • using threads
  • using system PCRE library
  • using system OpenSSL library
  • using system zlib library

nginx path prefix: "/data/app/nginx"
nginx binary file: "/data/app/nginx/sbin/nginx"
nginx modules path: "/data/app/nginx/modules"
nginx configuration prefix: "/data/app/nginx/conf"
nginx configuration file: "/data/app/nginx/conf/nginx.conf"
nginx pid file: "/data/app/nginx/logs/nginx.pid"
nginx error log file: "/data/app/nginx/logs/error.log"
nginx http access log file: "/data/app/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"

[root@pro-zdb-nginx01-NEW nginx-1.19.4]# make
....
objs/addon/nginx_upstream_check_module-0.4.0/ngx_http_upstream_check_module.o
objs/ngx_modules.o
-ldl -lpthread -lpthread -lcrypt -lpcre -lssl -lcrypto -ldl -lpthread -lz
-Wl,--enable-new-dtags -Wl,-rpath,/usr/lib64/perl5/CORE -fstack-protector -L/usr/lib64/perl5/CORE -lperl -lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
-Wl,-E
sed -e "s|%%PREFIX%%|/data/app/nginx|"
-e "s|%%PID_PATH%%|/data/app/nginx/logs/nginx.pid|"
-e "s|%%CONF_PATH%%|/data/app/nginx/conf/nginx.conf|"
-e "s|%%ERROR_LOG_PATH%%|/data/app/nginx/logs/error.log|"
< man/nginx.8 > objs/nginx.8
make[1]: Leaving directory `/usr/local/src/nginx-1.19.4'
[root@pro-zdb-nginx01-NEW nginx-1.19.4]#

upstream 配置
upstream pre-front-oms {
server 172.16.9.155:8762;
server 172.16.9.211:8762;
check interval=2000 rise=2 fall=5 timeout=1000 type=http;
check_http_send "GET /index.html HTTP/1.0\r\n\r\n"; #获取后端资源,资源变动后,经历三次检查周期后立即将状态改为down
check_http_expect_alive http_2xx http_3xx ; #check_http_send 返回状态码,2xx和3xx为默认值。
}

请问为什么还是会报 unknown directive "check" in问题

@wklken
Copy link

wklken commented Mar 29, 2024

make install之后只是做二进制文件替换,之后执行reload是没有用的,还是老版本

可以看下编译后目录下的 Makefile, 里面有个upgrade

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants