yaoweibin / nginx_upstream_check_module

Health checks upstreams for nginx
http://github.com/yaoweibin/nginx_upstream_check_module
2.06k stars 484 forks source link

nginx1.8.0使用nginx_upstream_check_module使用问题 #69

Open zouzhenhui opened 9 years ago

zouzhenhui commented 9 years ago

我在使用时报如下错误:

tar zxvf nginx-1.8.0.tar.gz

cd nginx-1.8.0

patch -p1 < /root/nginx_upstream_check_module-master/check.patch

./configure --prefix=/usr/local/nginx --add-module=/root/ngx_cache_purge-2.3 --with-http_stub_status_module --with-http_gzip_static_module --add-module=/root/nginx_upstream_check_module-master

make

...... src/http/modules/ngx_http_upstream_ip_hash_module.c: 在函数‘ngx_http_upstream_get_ip_hash_peer’中: src/http/modules/ngx_http_upstream_ip_hash_module.c:229: 错误:break 语句不在循环或开关语句内 src/http/modules/ngx_http_upstream_ip_hash_module.c: 在文件层: src/http/modules/ngx_http_upstream_ip_hash_module.c:246: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘->’ token src/http/modules/ngx_http_upstream_ip_hash_module.c:248: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘->’ token src/http/modules/ngx_http_upstream_ip_hash_module.c:249: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘->’ token src/http/modules/ngx_http_upstream_ip_hash_module.c:250: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘->’ token src/http/modules/ngx_http_upstream_ip_hash_module.c:252: 错误:expected identifier or ‘(’ before ‘if’ src/http/modules/ngx_http_upstream_ip_hash_module.c:258: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘->’ token src/http/modules/ngx_http_upstream_ip_hash_module.c:259: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘->’ token src/http/modules/ngx_http_upstream_ip_hash_module.c:261: 错误:expected identifier or ‘(’ before ‘return’ src/http/modules/ngx_http_upstream_ip_hash_module.c:262: 错误:expected identifier or ‘(’ before ‘}’ token make[1]: * [objs/src/http/modules/ngx_http_upstream_ip_hash_module.o] 错误 1 make[1]: Leaving directory `/root/nginx-1.8.0' make: * [build] 错误 2

NikolayMurha commented 9 years ago

You should use check_1.7.5+.patch instead check.patch

zouzhenhui commented 9 years ago

谢谢! 我使用check_1.7.5+.patch 进行安装,但是打开监控页面(http://192.168.1.200/Nginx_Status)报404错误,安装时没有任何错误,我的配置如下: 使用nginx自带的监控模块是正常的(http://192.168.1.200:8888/Nginx_Status) 我的配置如下: [root@tnginx conf]# cat nginx.conf

user nobody nobody; worker_processes 1; worker_rlimit_nofile 65535;

error_log logs/error.log;

error_log logs/error.log notice;

error_log logs/error.log info;

pid /var/run/nginx.pid;

events { use epoll; worker_connections 65535; }

http { include mime.types; default_type application/octet-stream; charset utf-8; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"';

access_log  logs/access.log  main;
server_names_hash_bucket_size 256;
client_max_body_size 50m;
client_header_buffer_size 256k;
large_client_header_buffers 4 256k;

sendfile        on;
tcp_nopush     on;
tcp_nodelay    on;
#keepalive_timeout  0;
keepalive_timeout  120;
client_body_buffer_size 512k;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;

gzip  on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
include sites/*.conf;

upstream www.test.com{
ip_hash;
server 192.168.1.201:80 ;
server 192.168.1.202:80 ;
    check interval=3000 rise=2 fall=5 timeout=20000;
}

server { location /Nginx_Status { check_status; access_log off;

allow SOME.IP.ADD.RESS;

      #deny all;
          }
    }   
server {
            listen 8888 ;
            location /Nginx_Status {
            stub_status on;
            access_log off;
         }
 }

}

zouzhenhui commented 9 years ago

cd nginx-1.8.0

history

patch -p1 < /root/nginx_upstream_check_module-master/check_1.7.5+.patch

./configure --prefix=/usr/local/nginx --add-module=/root/ngx_cache_purge-2.3 --with-http_stub_status_module --with-http_gzip_static_module --add-module=/root/nginx_upstream_check_module-master

make

make install

我是按这种方法装的,期间没有报任何错误,装完后模块就是不生效,那位朋友帮忙指点一下,非常感谢!