apache或者nginx一个域名反向代理多个应用系统

一个域名三个服务,
http://www.abc.com/test1/ 192.168.0.8:121,
http://www.abc.com/test2/ 192.168.0.8:122,
http://www.abc.com/test3/ 192.168.0.8:123,
怎么配置啊?

http{
...
server {
location /test1/ {
proxy_pass http://192.168.0.8:121
proxy_set_header X-Real-IP $remote_addr;
}

    location /test2/ {
            proxy_pass http://192.168.0.8:122
            proxy_set_header    X-Real-IP $remote_addr; 
    }

    location /test1/ {
            proxy_pass http://192.168.0.8:123
            proxy_set_header    X-Real-IP $remote_addr; 
    }
}

}