nginx cookie 会话保持功能

时间:2021-11-22 08:32:26

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
nginx  cookie  会话保持功能
    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=/; }
nginx  cookie  会话保持功能

nginx  cookie  会话保持功能

nginx  cookie  会话保持功能
  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  会话保持功能

nginx  cookie  会话保持功能