首先:本地主机host更改成
192.168.111.1 gulimail.com
这样一访问网址就能映射到本地、
然后修改nginx得conf
worker_processes 1; events { worker_connections 1024; } http { upstream gulimail { server 192.168.111.1:88; } server { listen 80; server_name gulimail.com; location / { proxy_pass http://gulimail; } } }
server部分是访问
gulimail.com得八零端口就会找
http://gulimail->然后看到负载均衡就会转到
192.168.111.1:88得网关得位置。;
我们需要将网址访问80端口-然后访问nginx然后通过nginx访问80端口转发到网关得88端口,然后网关根据规则转发到页面或者接口。
worker_processes 1; events { worker_connections 1024; } http { upstream gulimail { server 192.168.111.1:88; } server { listen 80; server_name gulimail.com; location / { proxy_set_header Host $host; proxy_pass http://gulimail; } } }
通过nginx跳转会丢失host等信息需要我们发现并补充。
网关配置
- id: product_route
uri: lb://gulimall-product
predicates:
- Host=**.gulimail.com