[Nginx]Nginx调度配置session共享服务,实现数据统一。
通过此功能实现在web集群的情况下实现用户登陆过程中只需要登陆一次,就可以访问集群web服务器。避免了重复登陆。
Nginx调度配置搭建参考:https://teddyou.com/?id=14
调度服务器安装:
yum -y install memcached //安装memcached数据库
systemctl restart memcached //启动memcached数据库
systemctl enable memcached //设为开机启动
配置后端集群服务器:
配置PHP页面支持:https://teddyou.com/?id=12
yum -y install php-pecl-memcache //安装页面支持模块
vim /etc/php-fpm.d/www.conf //修改配置文件
按G跳到最后
php_value[session.save_handler] = memcache //修改files为memcache
php_value[session.save_path] = "tcp://调度服务器IP:11211" //默认端口11211
systemctl restart php-fpm //重启服务
发表评论