Mac为nginx安装nginx-sticky-module


nginx版本: nginx-1.9.8

nginx-sticky-module版本:nginx-sticky-module-ng

*注意产品环境请慎用!

参考来源:

Nginx模块之SessionSticky

bitbucket.org

使用nginx sticky模块实现基于cookie的负载均衡

NGINX 3rd Party Modules

下载

很多网站介绍sticky_module的来源和版本都不太一样,我尝试了下面来自于github上从google搬过去的1.0版本,和bitbucket.org的ng版本

https://github.com/lusis/nginx-sticky-module

.

https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng

.

当然还有google版本

http://nginx-sticky-module.googlecode.com/files/nginx-sticky-module-1.1.tar.gz

目前共有2个版本,一个是1.0,一个是1.1,1.0已经寿终正寝了。1.1增加了权重的参数。

安装

先尝试github上clone的版本

* make 的时候会出现错误,可能是由于和我自己当前的nginx版本太高相关:
/Users/Richard/Documents/Dev/github/nginx-sticky-module/ngx_http_sticky_module.c:335:21: error:
incompatible integer to pointer conversion assigning to
'ngx_http_upstream_rr_peer_t *' (aka 'struct ngx_http_upstream_rr_peer_s
*') from 'int' [-Werror,-Wint-conversion]
iphp->rrp.current = iphp->selected_peer;
^ ~~~~~~~~~~~~~~~~~~~
/Users/Richard/Documents/Dev/github/nginx-sticky-module/ngx_http_sticky_module.c:342:19: error:
variable 'n' may be uninitialized when used here
[-Werror,-Wconditional-uninitialized]
iphp->rrp.tried[n] |= m;
^
/Users/Richard/Documents/Dev/github/nginx-sticky-module/ngx_http_sticky_module.c:267:33: note:
initialize the variable 'n' to silence this warning
ngx_uint_t n, i;
^
= 0
/Users/Richard/Documents/Dev/github/nginx-sticky-module/ngx_http_sticky_module.c:342:25: error:
variable 'm' may be uninitialized when used here
[-Werror,-Wconditional-uninitialized]
iphp->rrp.tried[n] |= m;
^
/Users/Richard/Documents/Dev/github/nginx-sticky-module/ngx_http_sticky_module.c:266:33: note:
initialize the variable 'm' to silence this warning
uintptr_t m;
^
= 0
3 errors generated.
make[1]: *** [objs/addon/nginx-sticky-module/ngx_http_sticky_module.o] Error 1
make: *** [build] Error 2

再尝试nginx.com上推荐的bitbucket.org版本

先clone

$ git clone https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng.git

./configure将目标路径指向当前的nginx实例

$ ./configure --prefix=/Users/Richard/Documents/Dev/servers/cluster/nginx/node-a --add-module=/Users/Richard/Documents/Dev/github/nginx-sticky-module-ng

然后make && sudo make install

一切正常

...

test -d '/Users/Richard/Documents/Dev/servers/cluster/nginx/node-a/logs' 		|| mkdir -p '/Users/Richard/Documents/Dev/servers/cluster/nginx/node-a/logs'
test -d '/Users/Richard/Documents/Dev/servers/cluster/nginx/node-a/logs' || mkdir -p '/Users/Richard/Documents/Dev/servers/cluster/nginx/node-a/logs'
test -d '/Users/Richard/Documents/Dev/servers/cluster/nginx/node-a/html' || cp -R html '/Users/Richard/Documents/Dev/servers/cluster/nginx/node-a'
test -d '/Users/Richard/Documents/Dev/servers/cluster/nginx/node-a/logs' || mkdir -p '/Users/Richard/Documents/Dev/servers/cluster/nginx/node-a/logs'

结束

Mac为nginx安装nginx-sticky-module的更多相关文章

  1. mac无坑安装nginx

    mac无坑安装nginx 首先需要mac下有一个缺失的软件包的管理器------->homebrew 1.打开终端输入 brew update 说明homebrew已经安装好了 2.继续执行以下 ...

  2. Mac Pro 编译安装 Nginx 1.8.1

    #下载相关源码包,统一放到 /usr/local/src 目录下: http://nginx.org/download/nginx-1.8.1.tar.gz http://zlib.net/zlib- ...

  3. Mac使用brew安装nginx,并解决端口访问权限问题

    1.安装 brew install nginx 2.修改配置文件 sudo vi /usr/local/etc/nginx/nginx.conf 修改默认的8080端口为80 修改日志文件地方 err ...

  4. 在 Mac OSX 上安装 nginx

    今天在使用 brew 安装 nginx 时,提示错误,安装不上去: brew install nginx, 提示:/usr/local is not writable. 这个是需要修改 /usr/lo ...

  5. Mac使用brew安装nginx,并解决端口80访问权限问题

    1.安装 brew install nginx 2.修改配置文件 sudo vi /usr/local/etc/nginx/nginx.conf 修改默认的8080端口为80 修改日志文件地方 err ...

  6. Mac OSX上安装Nginx

    1. 通过brew instal nginx安装 ==> Downloading https://homebrew.bintray.com/bottles/nginx-1.10.1.el_cap ...

  7. Nginx——安装Nginx(二)

    安装所需环境 Nginx 是 C语言 开发,建议在 Linux 上运行,当然,也可以安装 Windows 版本,本篇则使用 CentOS 7 作为安装环境. gcc 安装 安装 nginx 需要先将官 ...

  8. mac 使用 brew 安装 nginx 及各种命令

    一.安装 brew install nginx 或 sudo brew install nginx 二.启动 brew services start nginx 或 sudo brew service ...

  9. nginx安装 nginx: [emerg] getpwnam(“www”) failed 错误

    inux 64系统中安装nginx1.3时如果出现错误:nginx: [emerg] getpwnam(“www”) failed解决方法1:      在nginx.conf中 把user nobo ...

  10. Mac下用brew安装nginx

    1. nginx nginx [engine x] is an HTTP and reverse proxy server, a mail proxy server, and a generic TC ...

随机推荐

  1. MySQL C 客户端的内存泄漏问题

    我们的一个服务器软件在线上环境运行时出现了内存缓慢增长的问题. 用valgrind测试 MySQL的C客户端mysqlclient发现,它在正常的使用中会被valgrind报出存在内存泄漏. 1 正常 ...

  2. HDUOJ----4004The Frog's Games(二分+简单贪心)

    The Frog's Games Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others) ...

  3. JS中函数的 this 各种指向

    this是js的一个关键字,随着函数使用场合不同,this的值会发生变化.但是总有一个原则,那就是this指的是调用函数的那个对象. 情形1:如果一个函数中有this,但是它没有被上一级的对象所调用, ...

  4. Android开发之5大布局方式详解

    Android中常用的5大布局方式有以下几种: 线性布局(LinearLayout):按照垂直或者水平方向布局的组件. 帧布局(FrameLayout):组件从屏幕左上方布局组件. 表格布局(Tabl ...

  5. C# 发布REST接口地址API服务

    原文地址:https://blog.csdn.net/chinacsharper/article/details/21256569 今天碰巧,用到了淘宝的在线IP地址查询的Rest API,它提供接口 ...

  6. 统计svn 代码提交情况

    统计svn代码提交,使用工具 statsvn.jar 下载地址:http://sourceforge.net/projects/statsvn/ rem 声明一个时间变量 作为文件名 %time:~, ...

  7. wavwrite注意事项

    前几天群里有人提出一个问题:MATLAB里,同样频率的信号写入/读取,为什么频率感觉不同? 测试code: fs = 2000; f0 = 20; t = 0:1/fs:1; subplot 211 ...

  8. FBX BlendShape/Morph动画解析

    目前fbx 2015.1中支持三种变形器:skinDeformer,blendShapeDeformer,vertexCacheDeformer.定义在fbxdeformer.h中: enum EDe ...

  9. 为什么easyui的datagrid里getSelections还有getChecked只能获取一行值呢?

    http://jquery-easyui.wikidot.com/forum/t-280470 如果没有 idField属性,getSelections就只能获取一个行的值了 注意:如果用了前面说的& ...

  10. JavaScript之正則表達式入门

    <html> <head><title>Js String 正則表達式</title><script>//边界符 js 中直接定义须要边界符 ...