csdn_sqj
2020-01-10 10:05
采纳率: 50%
浏览 1.3k
已采纳

紧急求助!springcloud:为什么我的zuul配置的路由没有生效?

图片说明
+++++++++++++
图片说明
图片说明
+++++++++++++
我在网关模块做了一下配置
zuul:
prefix: /api
routes:
item-service: /item/** #路由到商品的微服务

图片说明
++++++++++++
nginx的配置

#user  nobody;
worker_processes  1;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#pid        logs/nginx.pid;
events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';
    #access_log  logs/access.log  main;
    sendfile        on;
    #tcp_nopush     on;
    #keepalive_timeout  0;
    keepalive_timeout  65;
    #gzip  on;

    server {
        listen       80;
        server_name  manage.leyou.com;

        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        location / {
             proxy_pass http://127.0.0.1:9001;
             proxy_connect_timeout 600;
             proxy_read_timeout 600;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
    server {
        listen       80;
        server_name  api.leyou.com;

        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        location / {
             proxy_pass http://127.0.0.1:9001;
             proxy_connect_timeout 600;
             proxy_read_timeout 600;
        }
    }
}

+++++++++
前端页面端口:9001
商品模块端口:8081
网关端口:10010
eureka端口:10086
|
我明明在网关里配置了api路由到item
为什么没有生效呢?
请大神指教,谢谢
++++++++++++++++++
更新
图片说明

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题