nginx请求转发和重写

    upstream   abc {
           server  112.162.15.234:8080;
    }

    server {
            listen       80;
            server_name   localhost;

            location / {
                 root html;
                 index  main.html;

            } 

            location   ^~/html/apis/ {
                rewrite ^/html/apis/(.*)$ /$1 break;
                proxy_pass  http://abc;
            }

    }

ajax 调用

               $.ajax({
                type:"GET",
                url:"/html/apis/user/adduser",
                datatype:  "json",
                success:function(data){
                    console.log(data);   
                }   
               });

你可能感兴趣的:(负载均衡)