当前位置:网站首页>Redies(四) session共享的优化
Redies(四) session共享的优化
2022-08-05 22:33:00 【谁是黄黄】
优化之前图解:
一. Linux 中安装 Nginx
1.1安装步骤:
- 下载 wget https://nginx.org/download/nginx-1.20.1.tar.gz
- 解压 tar -zxvf nginx-1.20.1.tar.gz
- yum install -y zlib-devel
- yum -y install pcre pcre-devel
- 进入到 nginx 解压目录
- ./configure
- make
- make install
- 进入nginx.config中进行配置

配置上游服务器

设置配置
由于黄黄这里是用的8083和8084端口,所以我们这里要更改一下
配置拦截策略
这一块就是我们拦截的策略,/ 表示的是拦截所有的请求,这也就是为什么我们之前每次访问nginx的时候都是直接访问到index.html的页面的原因
即登录到nginx后他自动去里面的html去找,找我们之前设置的html的配置页面,但是这里我们要对他进行更改。
我们现在的需求:当我们的请求到了之后,nginx把我们的请求转发到我们的toncat上面去。
配置拦截重定向

1.我们这里的请求都是要求它经过nginx的
2.但是如果有某一次请求经过nginx到了tomcat1,但是tomcat1这时候要报一个302回去,tomcat1或者说上游服务器都是不知道nginx这种负载均衡服务器的存在的,tomcat1就只能把结果返回给浏览器,且tomcat1的这个重定向的地址还是指向了tomcat1自己。
3.所以我们这里需要对重定向进行拦截,这样拦截的作用是让tomcat或者说上游服务器一定要经过nginx才行。
10.启动:sbin/nginx
黄黄的错误
黄黄由于多次重复启动,导致nginx自己占用了自己的80端口,并且我们在nginx.conf
里面去更改他的配置端口也是没用的,后来黄黄只能去删除掉自己的nginx进程
如下操作
killall -9 nginx


二. 优化后的测试
2.1 

发现实现了两个端口之间共享session的功能
边栏推荐
- 归并排序(Merge Sort)
- 当你收到面试通知后,通过如下的准备可以大大提升面试成功率
- Exploration and practice of Redis fixed-length queue
- 关于 SAP UI5 floating footer 显示与否的单步调试以及使用 SAP UI5 的收益
- 桶排序(Bucket Sort)
- 大家常说的表空间到底是什么?究竟什么又是数据表呢?
- 将trivydb转转化为mysql、sqlite的小工具
- Qt使用wget下载文件案例
- Application Prospect and Application Benefit of APS in Printing Industry
- APS Solutions for Printing Industry
猜你喜欢

给初入测试/开发程序员的几点建议,把困难当做猎物......
![[GKCTF 2021]easycms](/img/8d/1d83f81f2130a44e98f2cf3dfcf71c.png)
[GKCTF 2021]easycms

Day11: binary tree -- - > full ~, ~, heap completely

What are the current pain points of domestic BLDC motor control solutions?

我劝!这位年轻人不讲MVCC,耗子尾汁!
![60: Chapter 5: Develop admin management services: 13: Develop new functions of [Add/Modify Friendship Links, Interfaces]; (Add data to MongoDB) (To operate the Dao layer interface of MongoDB, you must](/img/af/c102dea7ab6290443d809e276cb0d5.png)
60: Chapter 5: Develop admin management services: 13: Develop new functions of [Add/Modify Friendship Links, Interfaces]; (Add data to MongoDB) (To operate the Dao layer interface of MongoDB, you must

什么情况会导致 MySQL 索引失效?

网页提示此站点不安全,还能打开吗?

Login and register (unpackaged) flask

对NotNull字段插入Null值有啥现象?
随机推荐
leetcode:291. 单词规律
视觉slam学习|基础篇02
[Flask] Deploy flask using gevent
MySQL中常见的嵌套查询有哪些
MySQL简介
DB307S-ASEMI贴片整流桥DB307S
MySQL GROUP BY 分组后加条件HAVING使用方法
Day11:二叉树---->满~、完全~、堆
AWTK开发编译环境踩坑记录2(VS Code检测到#include 错误)
论如何下载网页中的m3u8/ts视频
七夕时如何拯救躁动不安的心
LSN、Checkpoint?MySQL的崩溃恢复是怎么做的?
七夕节最深情表白文案从此告别搓衣板
ESP8266-Arduino编程实例-金属触摸传感器驱动
S32K1xx 系列安全手册
C language basic walkthrough(9)
了解MySQL数据页吗?说说什么是页分裂吧!
Nanoprobes丨GoldiBlot 用于 His-tag 检测方案
快速排序(Quick Sort)
js监听退出全屏事件