运维小知识之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);

        

         后记

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

目录
相关文章
|
5天前
|
应用服务中间件 nginx
百度搜索:蓝易云【利用nginx内置ngx_http_mirror_module模块实现流量复制及流量放大】
以上就是使用Nginx内置 `ngx_http_mirror_module`模块实现流量复制和流量放大的简要示例。通过合理配置和利用该模块,可以实现更复杂的流量控制和调试需求。
67 1
|
5天前
|
应用服务中间件 nginx
百度搜索:蓝易云【HTTP请求是如何关联Nginx server{}块的?】
总结来说,Nginx中的 `server{}`块用于关联HTTP请求和虚拟主机,通过配置不同的 `server{}`块,可以实现多个域名或IP地址的请求分发和处理。这样,Nginx可以根据不同的请求来提供不同的服务和内容。
40 0
|
5月前
|
应用服务中间件 Linux nginx
nginx+nginx-http-flv-module
nginx+nginx-http-flv-module
213 1
|
8月前
|
网络协议 Linux 应用服务中间件
2022红帽企业版网络配置--centos7配置DHCP DNS绑定域名 FTP HTTP(apache) nginx samba
2022红帽企业版网络配置--centos7配置DHCP DNS绑定域名 FTP HTTP(apache) nginx samba
159 0
|
4天前
|
监控 Unix 应用服务中间件
Android-音视频学习系列-(八)基于-Nginx-搭建(rtmp、http)直播服务器
Android-音视频学习系列-(八)基于-Nginx-搭建(rtmp、http)直播服务器
|
5天前
|
缓存 负载均衡 应用服务中间件
如何在 CentOS 7 上为 NGINX 安装开源 HTTP 加速器:Varnish
如何在 CentOS 7 上为 NGINX 安装开源 HTTP 加速器:Varnish
76 1
如何在 CentOS 7 上为 NGINX 安装开源 HTTP 加速器:Varnish
|
5天前
|
网络协议 应用服务中间件 nginx
nginx 302 301 设置 url 转跳 nginx 资源重定向 nginx tcp 和 http 转发
nginx 代理后端网站,和 网站资源目录重定向到其他连接地址
73 3
|
5天前
|
前端开发 应用服务中间件 网络安全
http转为https,ssl证书安装及nginx配置
http转为https,ssl证书安装及nginx配置
68 1
|
6月前
|
负载均衡 Unix 应用服务中间件
深入解析HTTP反向代理:探索NGINX的神奇之处
深入解析HTTP反向代理:探索NGINX的神奇之处