What command do I put into a command block that can set the spawn of the nearest player to a different specific location? [duplicate]

You can do /setspawn @p 50 64 50. @p targets the nearest player, and 50 64 50 is the x,y and z coordinates. If the set player dies they will respawn at the set coordinates.