Mac为nginx安装nginx-sticky-module
Mac为nginx安装nginx-sticky-module
nginx版本: nginx-1.9.8
nginx-sticky-module版本:nginx-sticky-module-ng
*注意产品环境请慎用!
参考来源:
使用nginx sticky模块实现基于cookie的负载均衡
下载
很多网站介绍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的更多相关文章
- mac无坑安装nginx
mac无坑安装nginx 首先需要mac下有一个缺失的软件包的管理器------->homebrew 1.打开终端输入 brew update 说明homebrew已经安装好了 2.继续执行以下 ...
- Mac Pro 编译安装 Nginx 1.8.1
#下载相关源码包,统一放到 /usr/local/src 目录下: http://nginx.org/download/nginx-1.8.1.tar.gz http://zlib.net/zlib- ...
- Mac使用brew安装nginx,并解决端口访问权限问题
1.安装 brew install nginx 2.修改配置文件 sudo vi /usr/local/etc/nginx/nginx.conf 修改默认的8080端口为80 修改日志文件地方 err ...
- 在 Mac OSX 上安装 nginx
今天在使用 brew 安装 nginx 时,提示错误,安装不上去: brew install nginx, 提示:/usr/local is not writable. 这个是需要修改 /usr/lo ...
- Mac使用brew安装nginx,并解决端口80访问权限问题
1.安装 brew install nginx 2.修改配置文件 sudo vi /usr/local/etc/nginx/nginx.conf 修改默认的8080端口为80 修改日志文件地方 err ...
- Mac OSX上安装Nginx
1. 通过brew instal nginx安装 ==> Downloading https://homebrew.bintray.com/bottles/nginx-1.10.1.el_cap ...
- Nginx——安装Nginx(二)
安装所需环境 Nginx 是 C语言 开发,建议在 Linux 上运行,当然,也可以安装 Windows 版本,本篇则使用 CentOS 7 作为安装环境. gcc 安装 安装 nginx 需要先将官 ...
- mac 使用 brew 安装 nginx 及各种命令
一.安装 brew install nginx 或 sudo brew install nginx 二.启动 brew services start nginx 或 sudo brew service ...
- nginx安装 nginx: [emerg] getpwnam(“www”) failed 错误
inux 64系统中安装nginx1.3时如果出现错误:nginx: [emerg] getpwnam(“www”) failed解决方法1: 在nginx.conf中 把user nobo ...
- Mac下用brew安装nginx
1. nginx nginx [engine x] is an HTTP and reverse proxy server, a mail proxy server, and a generic TC ...
随机推荐
- 常用jdbc操作
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); Connection con = DriverMa ...
- C 应用
前言 1)操作符两端必须加空格,(每行第一个赋值语句对齐). 2)变量名必须是英文(不能是拼音):英文.数字.下划线和美元符号. 3)等于号 == 反过来写(0 == i%4)防止少些赋值号的错误. ...
- 工作总结 Mapper.Map 映射 AutoMapper
对象映射工具 //1.创建映射规则 ,第一个参数为源实体(Model),第二个为目标实体(DTO) Mapper.CreateMap<studentSource, studentPurpost ...
- JMeter学习-内存溢出解决方法
现象:使用jmeter进行压力测试时遇到一段时间后报内存溢出outfmenmory错误,导致jmeter卡死了 方法一: windows环境下,修改jmeter.bat: set HEAP=-Xms2 ...
- python添加tab键自动补全功能
默认python是没有tab键补全功能的: >>> import tab Traceback (most recent call last): File "<stdi ...
- Android studio 如何让包有层次显示
Android studio中我新建的包在原来包名后面显示,而我想让包名能层次展示: 方法: 点击如图部分,在弹出框中 去掉 ”compact empty middle package“前面勾
- exec系列函数和system函数
一.exec替换进程映象 在进程的创建上Unix采用了一个独特的方法,它将进程创建与加载一个新进程映象分离.这样的好处是有更多的余地对两种操作进行管理.当我们创建 了一个进程之后,通常将子进程替换成新 ...
- 图解最小生成树 - 克鲁斯卡尔(Kruskal)算法
我们在前面讲过的<克里姆算法>是以某个顶点为起点,逐步找各顶点上最小权值的边来构建最小生成树的.同样的思路,我们也可以直接就以边为目标去构建,因为权值为边上,直接找最小权值的边来构建生成树 ...
- HDU1024 Max Sum Plus Plus 【DP】
Max Sum Plus Plus Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- HDU 3395 Special Fish 最“大”费用最大流
求最大费用能够将边权取负以转化成求最小费用. 然而此时依旧不正确.由于会优先寻找最大流.可是答案并不一定出如今满流的时候.所以要加一些边(下图中的红边)使其在答案出现时满流. 设全部边的流量为1,花费 ...