1、下载nginx-1.9.10.tar.gz nginx-sticky-module-1.1.tar.gz
2、解压:
tar -xzvf nginx-1.9.10.tar.gz
tar -xzvf nginx-sticky-module-1.1.tar.gz
3、进入nginx-1.9.10目录
4、编译安装
./configure --prefix=/usr/local/nginx-1.9.10 --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --add-module=../nginx-sticky-module-1.1makemake install
启动
/etc/nginx/sbin/nginx -s reload
修改Nginx.conf
upstream test{
sticky;
server 192.168.159.10:8080;
server 192.168.159.11:8080;
}
sticky;
server 192.168.159.10:8080;
server 192.168.159.11:8080;
}