# SpringCloud组件设计原理及实战(上) **Repository Path**: clj2ee/springcloud-1 ## Basic Information - **Project Name**: SpringCloud组件设计原理及实战(上) - **Description**: 第三阶段第四模块-SpringCloud组件设计原理及实战(上) - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2020-06-28 - **Last Updated**: 2021-05-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # spring cloud-1 ## nginx 1.需要配置host文件 ```text # nginx 域名 127.0.0.1 www.abc.com # 两个eureka server地址 127.0.0.1 LagouCloudEurekaServerA 127.0.0.1 LagouCloudEurekaServerB ``` 2. nginx.conf ```text server { # 虚拟主键监听的端口 listen 8099; # 虚拟主机的访问ip/域名/ip:port server_name www.abc.com; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; location /api { proxy_pass http://localhost:9002; proxy_connect_timeout 300s; proxy_send_timeout 300s; proxy_read_timeout 300s; } location / { root html/static/; index index.html index.html; } } ``` 3 静态页面 静态页面已经放到nginx中 ## 访问说明 1.http://www.abc.com:8099 ![](./images/index.png) * 页面加载完成请求http://www.abc.com:8099/api/user/info,后端网关服务gateWay会进行拦截,获取token,token为空或者通过token没有获取用户为空,则页面中进行重定向到登录页 2.http://www.abc.com:8099/login.html ![](./images/login.png) * 当用户发起登录请求时,网关服务会进行拦截,进行参数判断,登录成功后,会将token写入到cookie中并存入数据库,当用户访问首页时,后端从cookie中获取token进而获取邮箱地址 3.http://www.abc.com:8099/registry.html ![](./images/registry.png) * 当用户点击获取验证码时,首先判断该邮箱地址是否已经注册,如果已经注册,重定向到登录页,没有注册进而请求发送验证码服务;点击注册请求用户服务的注册功能,注册成功后,重定向到登录页