学习搭建本地nacos集群,nginx代理nacos集群,只有8848端口可被服务发现注册服务

在nginx config文件配置好listen的端口号,配置其他的端口号时,可以用网址访问nacos配置页面,但是服务无法连接nginx代理的nacos集群,只有配置为8848端口才可以连接nacos集群注册服务。
我是用yml文件做的配置 按照官方文档的步骤调用 Nacos open api 向 Nacos Server 发布配置:dataId 为example.yaml,内容为useLocalCache=true
运行 NacosConfigApplication,调用 curl http://localhost:8080/config/get,返回内容却是 false
不知道自己哪犯错了,有没有人能指个方向

讨论数量: 1

检查一下,下面两个配置

bootstrap.yml

cloud:
  nacos:
    discovery:
      #nacos集群配置(Nginx) nginx的ip和监听的端口
      server-addr: 192.168.15.146:80

nginx 配置

http {
    ...

    #nacos集群负载均衡,nacos集群ip
    upstream nacos-cluster {
        server 192.168.15.145:8848;
        server 192.168.15.147:8848;
        server 192.168.15.148:8848;
    }

    server {
        listen       80;
        server_name  192.168.15.146;

        location / {
            #root   html;
            #index  index.html index.htm;
            proxy_pass http://nacos-cluster;
        }
    }
}
1年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!