nginx加载sticky模块

sticky 模块安装
1,下载包

wget https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/get/08a395c66e42.zip
2,解压

unzip -D 08a395c66e42.zip

3,修改文件夹名

mv nginx-goodies-nginx-sticky-module-ng-08a395c66e42 nginx-sticky-module-ng
4,修改
cd /usr/local/nginx/sbin

./nginx -v 查看安装版本

./nginx-V 查看已经安装的模块

 --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35

5,重新编译模块

cd cd nginx-1.16.1/

./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35 --add-module=/usr/local/src/nginx-sticky-module-ng
make
make install

6,重启nginx

cd /usr/local/nginx/sbin

./nginx -s stop

./nginx -c /usr/local/nginx/conf/nginx.conf

7,放开sticky模块

例子如下

upstream alb-web{
sticky;
server 172.30.1.61:8080;
server 172.30.1.61:8080;
}

8,页面访问

chrome浏览器中 application中显示route字段就行

默认单个节点是sticky模块是不会生效的

相关推荐