Physics - Capsule, Rigidbody - Falls over

I have got a Capsule as player that can be controlled. Added Rigidbody to him so he does not fall through the terrain (which has a terrain collider).

Now to my problem. Sometimes, when hes walking on a higher ground or colliding with a tree, the capsule falls over. How to fix it, that the gravity does not cause him to fall over?

Okay go to your rigid body and there should be a freeze rotation tab , check x and z to stop the falling