Generally speaking its best to place your fingers as close to the frets as possible without actually touching the fret. The reason being you wont have to apply so much pressure to the strings and ultimately develop a lighter touch on the fretboard.
Adopting the “Cats Claw” posture can help get your fingertips into a more upright position. Just curl your first knuckle over at the first crease of your finger.
Your fingertips will get a little sore in the initial stages, but that will pass with regular playing
Keeping your thumbprint upright against the back of the neck can really help attain the right posture. If the palm of your hand is touching the bottom of the fretboard there is a good chance your fingers will get cramped up. For example I would often say to a student who is trying play an open chord, “Imagine you’re holding an egg in the palm of your hand . This help’s create more space and arch within the fingertips, or as I call it, the “cats claw” posture.