这四者是一样的
但是在用这些网址访问nacos控制页面时,有的需要登录,有的不用
需要登录
10.151.164.76/nacos/index.html
不需要登录
localhost/nacos/index.html
需要登录
10.151.164.76:80/nacos/index.html
不需要登录
localhost:80/nacos/index.html
一定要注意
有可能在nginx.conf中更改转发的地址后,可能你在nginx启动以后,再用nginx -s reload重载配置,可能并不会生效,很多人都遇到这个坑了,解决办法是:用taskkill /IM nginx.exe /F终止所有Nginx的进程,然后在重新启动start nginx.exe,然后再重载配置nginx -s reload就可以了
第二个坑:有时候你访问nacos的控制页面最好通过官方提供的完整路径,例如 http://10.151.164.76:8848/nacos/index.html(这是直接访问的网址),最好不要通过http://10.151.164.76:8848/nacos先到nacos登录页面,这样有时候会提示10.151.164.76拒绝服务,据我所知,报这种错误并不是由于这个主机写错了或者宕机了的缘故(有时候报localhost拒绝服务 也说明不了主机写错了或者宕机了的缘故这可能是nacos的Bug,所以你就老老实实访问完整的网址吧)。上面是直接访问的网址,通过Nginx负载均衡来访问是这个网址:10.151.164.76/nacos/index.html,这是因为我在nginx.conf里面是这么配置的:
其中upstream cluster { 和 proxy_pass http://cluster ; 中的 cluster仅仅是个代号:代表服务器池的名字,不代表会访问到 http://cluster 这个网址
listen 80; 说明我只要访问的网址的前缀是本机的80端口(即localhost:80/nacos/index.html)(或者10.151.164.76:80/nacos/index.html),就会通过负载均衡策略自动转到我配置的cluster服务池里面的某个网址下 的nacos/index.html,(比如http://10.151.164.76:8868/nacos/index.html),注意:直接访问localhost:80,后面没有接下来的网址了会爆localhost拒绝服务或者404 not found