[Answer]-Nginx sub-domain mapping

1👍

You can convert any 3rd level domain to 2nd level:

server {
    listen   80;
    server_name ~^(?<domain>.*)\.abc\.com;

    location / {
        proxy_pass http://abc.com/$domain$request_uri;
        break;
}

In your case try the next:

server {
    listen   80;
    server_name xyz.abc.com;

    location / {
        proxy_pass http://abc.com/xyz$request_uri;
        break;
}

About the request_uri: http://wiki.nginx.org/HttpCoreModule

Leave a comment