If the top is open it's even better.So away from a wall is best. You should place the upright almost agaist the wall but depending on your room size you could move the piano somewhere between de middle of the wall to one of the corners. Moving the piano to a corner will enhance the lower sounds.
Should an upright piano be placed against a wall?
Upright pianos should be placed against an inner wall, away from direct sunlight, air vents, doors, and windows. These measures help to preserve your piano's overall condition, tuning stability, and longevity. The majority of sound from an upright piano comes from the back of the instrument.
How far from the wall should an upright piano be?
A simple way to check is to place your hand on the wall. If, on a cold day, the wall feels significantly cold to the touch, don't put your piano there. If it doesn't, go ahead. Remember to leave the piano 3 inches or so from the wall.