nginx 反向代理注意事项

来源:互联网 发布:会员积分系统源码 编辑:程序博客网 时间:2024/05/22 14:32

1. 问题:nginx 采用 nginx_upstream_check_module模块 (下载地址 https://codeload.github.com/yaoweibin/nginx_upstream_check_module/zip/master)进行健康检查,配置 type=http无法检查到后端服务器是否存活,使用type=tcp才可以。 配置方式  check interval=3000 rise=2 fall=5 timeout=1000 type=http;  

原因:  http检查默认是按  upstream 中server配置的ip和端口检查的,也就是直接访问 http://ip:port的模式,等同于直接在浏览器 输入  http://ip:port。 如果这种访问不行,就必须通过 check_http_send 配置路径或者指定检查文件。如: check_http_send "HEAD /goods/check_status.html HTTP/1.0\r\n\r\n";  

2. 问题:采用  nginx-sticky-module模块进行会话保持(下载地址 https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/get/master.tar.gz ),进行破解编译时报错。

原因:破解路径不对,在  https://github.com/yaoweibin/nginx_upstream_check_module 中有写道:

If you want to add the support for nginx sticky module, you can do it
    like this:


        $ svn checkout http://nginx-sticky-module.googlecode.com/svn/trunk/ nginx-sticky-module
        $ cd nginx-sticky-module
        $ patch -p0 < /path/to/nginx_http_upstream_check_module/nginx-sticky-module.patch
        $ cd /path/to/nginx-1.0.14
        $ ./configure --add-module=/path/to/nginx_http_upstream_check_module --add-module=/path/to/nginx-sticky-module
        $ make
        $ make install


    Note that, the nginx-sticky-module also needs the original check.patch.







原创粉丝点击