I'm trying to setup an FTP subdomain, such that all incoming SFTP requests to (say) ftp.myname.com, get routed to a particular internal server, (say) 10.123.456 via port 22.

How do I use nginx to route this traffic?

I've already setup the SFTP server, and can SFTP directly to the server, say:

sftp [email protected], which works fine.

The problem is that when I setup nginx to route all traffic to ftp.myname.com, it connects, but the passwords get rejected. I have no problems routing web traffic to my other subdomains, say dev.myname.com (with passwords), but it doesn't work for the SFTP traffic:

server {
    listen 22;
    server_name ftp.myname.com;
    return .............
}

How do I define the return sting to route the traffic with the passwords?

The connection is SFTP (via port 22).

Thanks