server
{          
     listen 80;
     server_name www.test.com;
     location / {
         proxy_redirect off;
         proxy_set_header Host $http_host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_pass http: //172.16.1.5:8080;#这里填写内网B服务器, 以及对应的端口就可以转发过去了
     }
     access_log /data/wwwlogs/test.com. log ;
}


如果想做负载均衡可以这么配置

upstream test_server {
     server 172.16.1.5:8080;
     server 172.16.1.6:8080;
}
 
server
{          
     listen 80;
     server_name www.test.com;
     location / {
         proxy_redirect off;
         proxy_set_header Host $http_host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_pass http: //test_server;#这里test_server和upstream模块test_server是一样的
     }
     access_log /data/wwwlogs/test.com. log ;
}