docker nginx nacos反向代理集群配置

修改 /conf.d/default.conf [ 先备份 ]
upstream nacosserver {
    server 192.168.137.133:8848;
    server 192.168.137.133:8850;
    server 192.168.137.133:8852;
}

upstream sentinelserver {
    server 192.168.137.133:8858;
}

server {
    listen       80;
    listen  [::]:80;
    server_name  localhost;
    
    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;
    
    location / {
        # 注释掉原配置
        # root   /usr/share/nginx/html;
        # 注释掉原配置
        # index  index.html index.htm;
        # 修改 ↑
        proxy_pass http://nacosserver/nacos/;
    }

    location /sentinel/ {
        rewrite ^/sentinel/(.*)$ /$1 break;
        proxy_pass http://192.168.137.133:8858;
    }
    
    #error_page  404              /404.html;
    
    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}

你可能感兴趣的:(docker nginx nacos反向代理集群配置)