The folks who answered pretty much covered it all.
The ring height must be high enough the scope does not contact the barrel or bolt handle.
This gets to be more of a factor if you choose a scope with a large objective lens.
The ring height or stock geometry must also fit the shooter. Some folks struggle with scopes trying to "find" the image in the scope. Thats an indication the rifle is not set up right.
Its true the perfect stock fit might be a little different in different positions. Prone versus standing,for example.
So the "correct" answer might be a little different for a 14 lb bench gun versus a light hunting rifle you might want to tune for a shot standing on your hind legs.
For a hunting rifle,what I do for myself.. I tune for standing. I'm less wobbly when my inner ears are in a natural,level position. I don't scrunch my head down to the gun.
I bring the gun to my face,standing naturally.
My scope is positioned correctly if,with my rifle low,at "port arms", I can look at a target,close my eyes,then shoulder the rifle naturally,eyes still closed. Now I open my eyes. I must see the full,open field of view in the scope,crosshairs in the general direction of the target.
Its not OK to have to lift my head or wiggle my face to "find" the scope.
Once you set up your rifles this way,the struggle of "finding the target in the scope" goes away. I'm not suggesting you launch rifle bullets into the sky,but its not unrealistic to be able to find a target like a flushing pheasant in a 6X scope. Look at the target,shoulder the rifle,you should have full field of view through the scope.
Along with ring height,this is when you adjust eye relief. Use all the scope has to offer so long as you get full field of view.
That scope bell hitting your eyebow will make you bleed. Then you have a flinch to get over.
This ring height thing is why,IMO,the big astronomical 50 mm or 56 mm objective scopes are out of place on a hunting rifle.
In my experience,the "sweet spot" is usually 42mm objective lense or smaller,mounted in low rings.....But You have to find what fits you with your rifle.