微服务网关NginxGateway

远航
2022-11-27 / 0 评论 / 90 阅读 / 正在检测是否收录...

简单的例子🌰
upstream server2 {
    server 192.168.0.1:80;
    server 192.168.0.2:80;
}
server {
    listen       80;
    listen  [::]:80;
    server_name  localhost;
    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }
    // /api/s1 转发到http://192.168.0.3:80;
    location /api/s1 {
       proxy_pass   http://192.168.0.3:80;
    }
    // /api/s1 转发到http://server2;
    location /api/s2 {
       proxy_pass   http://server2;
    }
}
0

评论 (0)

取消