运维小知识之nginx---..nginx-sticky-module-1.1ngx_http_sticky_misc.cIn function ‘ngx_http_sticky_misc_text_


运维小知识之nginx---..nginx-sticky-module-1.1ngx_http_sticky_misc.cIn function ‘ngx_http_sticky_misc_text_raw



 

         背景

         今天笔者在使用nginx做负载均衡的过程中遇到了一个问题,如何解决session共享的问题,稍一查找发现解决办法不少,笔者使用的是nginx的一直扩展模块(安装和配置已经在前两篇博客有简单的介绍)在安装的过程中居然出现了问题,咱也不是逃避的人,解决吧,见下文。

        

         问题描述

make[1]: Entering directory`/usr/local/nginx-1.7.4'
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 -I src/http -Isrc/http/modules -I src/mail \
                -oobjs/addon/nginx-sticky-module-1.1/ngx_http_sticky_misc.o \
               ../nginx-sticky-module-1.1/ngx_http_sticky_misc.c
cc1: warnings being treated as errors
../nginx-sticky-module-1.1/ngx_http_sticky_misc.c:In function ‘ngx_http_sticky_misc_text_raw’:
../nginx-sticky-module-1.1/ngx_http_sticky_misc.c:281:error: passing argument 2 of ‘ngx_sock_ntop’makes integer from pointer without a cast
src/core/ngx_inet.h:110: note: expected ‘socklen_t’ but argument is of type ‘u_char *’
../nginx-sticky-module-1.1/ngx_http_sticky_misc.c:281:error: passing argument 3 of ‘ngx_sock_ntop’makes pointer from integer without a cast
src/core/ngx_inet.h:110: note: expected ‘u_char*’ but argument is of type ‘size_t’
../nginx-sticky-module-1.1/ngx_http_sticky_misc.c:281:error: too few arguments to function ‘ngx_sock_ntop’
make[1]: ***[objs/addon/nginx-sticky-module-1.1/ngx_http_sticky_misc.o] Error 1
make[1]: Leaving directory`/usr/local/nginx-1.7.4'
make: *** [build] Error 2



         解决方法

         进入nginx-sticky-module-1.1解压之后的文件夹

cd /usr/local/nginx-sticky-module-1.1


         编辑文件夹里面的ngx_http_sticky_module.c文件

vi ngx_http_sticky_module.c


         找到文件的地281行,做出如下修改

原digest->len =ngx_sock_ntop(in,digest
       ->data, len, 1);
改后digest->len =ngx_sock_ntop(in,sizeof(struct sockaddr_in),digest
       ->data, len, 1);

        

         后记

         今天状态不做,便把遇到的问题以及解决方法都稍微整理了一下,希望对读者有帮助,其实自己忘了,也能回来看看,一举两得。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值