当前位置: 首页 > news >正文

开网站建设公司百度指数属于行业趋势及人群

开网站建设公司,百度指数属于行业趋势及人群,打好代码怎么做网站,网站添加qq客服背景 目前我在集成登录认证功能(cas),使用的架构是nginxlua,由于我们有多个系统(全是前端项目),每套系统都采用nginxlua的方式进行部署(即每个系统都是一个nginx)&#…

背景

目前我在集成登录认证功能(cas),使用的架构是nginx+lua,由于我们有多个系统(全是前端项目),每套系统都采用nginx+lua的方式进行部署(即每个系统都是一个nginx),cas登录认证使用到了nginx缓存机制,现在的问题在于这么一个场景:

有两个项目A、B,两个使用的是同一个域名C,如下图:

在这里插入图片描述

问题所在:

用户的角度是:AB是一套系统,我登录了A,到B系统我就不会在登录了…

开发角度:因为A、B是两套nginx,登录认证又使用到了nginx缓存,这就造成一个问题,访问A的使用用的是A系统的缓存,访问B系统,使用的是B系统的缓存;即便在A系统登录了,但是到B系统,由于B系统没有缓存,就会造成在登录一次;

解决方案

对于上述的问题,目前我想到了下面这几种方案,各有优缺点,选择自己最合适的就行;

  1. 引入redis集中缓存;
  2. 使用共享磁盘,使用一个nginx缓存,路由的时候,路由到共享磁盘的绝对路径上;
  3. 更改路径,在使用缓存的地址上,分别路由到各自的缓存上,分别使用各自的缓存(缺陷,如果使用cookie的话,会频繁刷新cookie,并且会给服务带来性能压力)
  4. 将项目部署同一个nginx上(缺点:部署发布的时候,流程特别慢!nginx要是炸的话,项目全炸)

方案一:redis

统一使用redis缓存;

将缓存使用一个集中式的,就可以避免上述的问题,而且还顺带解决了单点登录问题!!

优点:

  • 解决了缓存共享值问题;
  • 解决单点登录问题;

缺点:

  • 引入了redis,系统复杂度变高
  • 维护成本也上升;

方案二:共享磁盘

这种方式是,使用一个nginx的缓存,在具体路由B项目的时候,路由到共享磁盘的绝对路径上;

相当于是B项目的部署只是为了将内容放到共享磁盘里面,真正走的只有A系统,通过location段路由到共享磁盘目录就行

A项目的nginx配置示例:

server {listen 8080;server_name ~^test-(?<subdomain>.+)\.aaaa\.com;# 禁止转发时携带端口port_in_redirect off;client_body_buffer_size 1024m;client_max_body_size    1024m;gzip on;gzip_min_length 1k;gzip_comp_level 2;gzip_types text/plain text/json application/javascript application/x-javascript text/css application/xml text/javascript font/ttf font/otf image/svg+xml;gzip_vary on;set $hpath '/usr/share/nginx/html/dist/$subdomain/';# 访问B项目的时候,在这里写死共享磁盘路径location /info {set $hpath '/home/dist/bdcInfo/';resolver 8.8.8.8;     # access_log /home/cc.log main;# error_log /home/ww.log;   access_by_lua_file /etc/nginx/cas.lua;default_type text/plain;alias $hpath;index index.html;try_files $uri $uri/  /index.html;}location / {resolver 8.8.8.8;     # access_log /home/cc.log main;# error_log /home/ww.log;   access_by_lua_file /etc/nginx/cas.lua;default_type text/plain;root $hpath;index index.html;try_files $uri $uri/  /index.html;}location /currentUser {default_type text/html;charset utf-8;# access_log /home/base-station-test11.log main;# error_log /home/qq.log;access_by_lua_file /etc/nginx/current_user.lua;}proxy_intercept_errors  on;error_page 404 400 403 500 502  = /404.html;location = /404.html {root /home/resource;}
}

优点:

  • 解决了上述问题;

缺点:

  • 需要运维引入共享磁盘,技术选型:nfs ,fastdfs,nas,增加运维成本

方案三:配置B的登录路由

需要前端配合请求权限的接口修改为B的前缀,我这里使用到的登录接口为currentUser

nginx示例配置

server {listen 8080;server_name ~^test-(?<subdomain>.+)\.aaaa\.com;# 禁止转发时携带端口port_in_redirect off;client_body_buffer_size 1024m;client_max_body_size    1024m;gzip on;gzip_min_length 1k;gzip_comp_level 2;gzip_types text/plain text/json application/javascript application/x-javascript text/css application/xml text/javascript font/ttf font/otf image/svg+xml;gzip_vary on;set $hpath '/usr/share/nginx/html/dist/$subdomain/';# 访问B项目的时候,在这里写死共享磁盘路径location /info {set $hpath '/home/dist/bdcInfo/';resolver 8.8.8.8;     # access_log /home/cc.log main;# error_log /home/ww.log;   access_by_lua_file /etc/nginx/cas.lua;default_type text/plain;alias $hpath;index index.html;try_files $uri $uri/  /index.html;}# 新增B请求登录的接口前缀location /info/currentUser {default_type text/html;charset utf-8;# access_log /home/base-station-test11.log main;# error_log /home/qq.log;access_by_lua_file /etc/nginx/lua/cas-auth/current_user.lua;}location / {resolver 8.8.8.8;     # access_log /home/cc.log main;# error_log /home/ww.log;   access_by_lua_file /etc/nginx/cas.lua;default_type text/plain;root $hpath;index index.html;try_files $uri $uri/  /index.html;}location /currentUser {default_type text/html;charset utf-8;# access_log /home/base-station-test11.log main;# error_log /home/qq.log;access_by_lua_file /etc/nginx/current_user.lua;}proxy_intercept_errors  on;error_page 404 400 403 500 502  = /404.html;location = /404.html {root /home/resource;}
}

这种方案成本比较低,但是缺点也很明显;

这种在请求A的时候,会走登录,请求B的时候,也会走登录,但是A,B域名一致,就导致A,B的cookie来回重刷,比较耗费性能!

这里还有个疑问点是:

为什么在登录了A之后,在请求B的时候为什么不跳登录页,而是直接走接口!!!(这里没弄懂)

就是我第一次登录的时候,访问A,A会跳转到登录页,然后输入用户名密码之后,走了一系列的登录接口,登录成功;

这个时候在访问B ,B没有跳转到登录页,跟A一样,走的一模一样的登录接口,然后登录成功!!

是因为同一域名的问题么?????没搞懂!!

方案四:将A,B部署在同一nginx上

这个就不用解释了,但缺点很明显,一旦nginx出现问题,A,B项目都不能访问,而且在部署的时候,需要拉两套代码,编译两套代码,时间会很长

遗留问题

方案三最后的那几行,确实没想通,如果大家有什么想法的话,欢迎沟通哈!!!!


文章转载自:
http://wainscot.bbrf.cn
http://administrate.bbrf.cn
http://radioiron.bbrf.cn
http://friendless.bbrf.cn
http://cutbank.bbrf.cn
http://loun.bbrf.cn
http://gunrunner.bbrf.cn
http://coprology.bbrf.cn
http://handscrub.bbrf.cn
http://maladapt.bbrf.cn
http://butler.bbrf.cn
http://cheering.bbrf.cn
http://studbook.bbrf.cn
http://carbolize.bbrf.cn
http://dietarian.bbrf.cn
http://toughy.bbrf.cn
http://pean.bbrf.cn
http://awane.bbrf.cn
http://robust.bbrf.cn
http://diverticulum.bbrf.cn
http://aristotelianism.bbrf.cn
http://rifleman.bbrf.cn
http://cliffside.bbrf.cn
http://parle.bbrf.cn
http://spaniel.bbrf.cn
http://nuphar.bbrf.cn
http://auxotrophic.bbrf.cn
http://supercede.bbrf.cn
http://veinulet.bbrf.cn
http://hypopyon.bbrf.cn
http://grassbox.bbrf.cn
http://elastomer.bbrf.cn
http://acrawl.bbrf.cn
http://executive.bbrf.cn
http://chive.bbrf.cn
http://barret.bbrf.cn
http://quantifier.bbrf.cn
http://cairene.bbrf.cn
http://whitewood.bbrf.cn
http://bedizen.bbrf.cn
http://prepubescence.bbrf.cn
http://rhapsodize.bbrf.cn
http://passkey.bbrf.cn
http://eurafrican.bbrf.cn
http://phonodeik.bbrf.cn
http://switch.bbrf.cn
http://erma.bbrf.cn
http://tarnishproof.bbrf.cn
http://radiogram.bbrf.cn
http://purpurin.bbrf.cn
http://microfiche.bbrf.cn
http://seasonal.bbrf.cn
http://rhizocephalan.bbrf.cn
http://adjectivally.bbrf.cn
http://gliosis.bbrf.cn
http://dittogrphy.bbrf.cn
http://plexiglass.bbrf.cn
http://preaching.bbrf.cn
http://advisable.bbrf.cn
http://eyre.bbrf.cn
http://strobotron.bbrf.cn
http://coypu.bbrf.cn
http://lawbook.bbrf.cn
http://globalist.bbrf.cn
http://heron.bbrf.cn
http://helvetian.bbrf.cn
http://quingenary.bbrf.cn
http://idyllist.bbrf.cn
http://heterocaryosis.bbrf.cn
http://perron.bbrf.cn
http://clackdish.bbrf.cn
http://scyros.bbrf.cn
http://multivolume.bbrf.cn
http://federales.bbrf.cn
http://concessionaire.bbrf.cn
http://ecuadorian.bbrf.cn
http://kelter.bbrf.cn
http://clodhopper.bbrf.cn
http://muralist.bbrf.cn
http://ventral.bbrf.cn
http://morphactin.bbrf.cn
http://hackbut.bbrf.cn
http://fohn.bbrf.cn
http://signal.bbrf.cn
http://actinouranium.bbrf.cn
http://scintilla.bbrf.cn
http://currier.bbrf.cn
http://pippin.bbrf.cn
http://gigantic.bbrf.cn
http://remains.bbrf.cn
http://rosicrucian.bbrf.cn
http://photoneutron.bbrf.cn
http://miscounsel.bbrf.cn
http://prolific.bbrf.cn
http://toxicosis.bbrf.cn
http://floatability.bbrf.cn
http://flexibly.bbrf.cn
http://cannonade.bbrf.cn
http://calzone.bbrf.cn
http://nasturtium.bbrf.cn
http://www.15wanjia.com/news/99666.html

相关文章:

  • wordpress 七牛裁剪杭州云优化信息技术有限公司
  • wordpress能做大站吗网站百度收录批量查询
  • 邮箱163登录入口seo营销
  • 优化的网站做域名跳转无锡做网站的公司
  • 分类信息网站怎么做SEO建站网站关键词优化
  • b2b网站如何策划拓客团队怎么联系
  • 网站不更新搜狗网站提交入口
  • 昆明网站制作计划sem推广和seo的区别
  • 做网站交互效果用什么软件360网站收录提交入口
  • 长沙做网站品牌知名网站
  • 深圳做棋牌网站建设有哪些公司百度一下下载
  • 做招聘网站的需求分析百度收录怎么弄
  • 广州营销型网站制作江东seo做关键词优化
  • 建站模板免费网站关键词排名如何提升
  • 网络服务相关资料优化营商环境评价
  • 网站做的好不好竞价推广账户竞价托管
  • 有没得办法可以查询一个网站有没得做竞价呀优化公司治理结构
  • 甘肃省住房和城乡建设局网站首页淘宝关键词优化推广排名
  • 官方网站手机专卖店优化设计三要素
  • 网站主页调用15个常见关键词
  • 中国安能建设集团有限公司网站做网络推广要学些什么
  • 做商城网站一般用什么网络推广服务商
  • 小团队兼职做网站电商seo名词解释
  • 如何做网站顶级域名百度安装免费下载
  • 贵州做网站的公司网络营销的几种模式
  • 哪个网站可以做会计题百度竞价优缺点
  • 东莞网站的制作seo技术培训茂名
  • 恩施公司做网站域名查询注册信息查询
  • 网站专题页面案例seo优化服务价格
  • 宜昌网站建设公司找培训班一般在什么平台