nginx cookie 会话保持功能
Posted zzzzy09
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx cookie 会话保持功能相关的知识,希望对你有一定的参考价值。
sticky 会话保持,基于自定义cookie 进行会话保持的方式
安装包下载地址:https://github.com/bymaximus/nginx-sticky-module-ng
./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/nginx.pid --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre=/usr/local/src/pcre-8.42 --with-zlib=/usr/local/src/zlib-1.2.11 --with-stream --add-module=/usr/local/src/nginx-1.14.2/echo-nginx-module-master --add-module=/usr/local/src/headers-more-nginx-module-master --add-module=/usr/local/src/nginx-sticky-module-ng-master
upstream webserver { server 10.2.61.23:8080 weight=1 max_fails=3 fail_timeout=5; #server 10.2.61.21:8021 backup; server 10.2.61.23:8000 weight=1 max_fails=3 fail_timeout=5; sticky expires=1h path=/; }
upstream webserver { server 10.2.61.23:8080 weight=1 max_fails=3 fail_timeout=5; #server 10.2.61.21:8021 backup; server 10.2.61.23:8000 weight=1 max_fails=3 fail_timeout=5; sticky name=srv_id expires=1h path=/; }
以上是关于nginx cookie 会话保持功能的主要内容,如果未能解决你的问题,请参考以下文章