Find a low butter box and ollie onto it from the side until you feel comfortable and you are being more "gentle". Next do the same with a low "tube" style rail (not one of the super fat lift tower ones, maybe one 6" in diameter) and work on the same thing. Even if you fall off the other side shortly after, just work on not coming on super heavy. Once you are more comfortable with that you can work on "catching" the rail with your heels so you don't come off the other side. Honestly that part almost comes naturally once you aren't ollieing crazy high and slamming down. This video shows that pretty well, but again it mostly is about being comfortable just getting on the rail and not panicking. Unless you are crazy off balance mostly what happens is you gently fall off to the front (no big deal, you ride away) or the back (also not bad unless you are leaning real hard, you just grab the rail with your hands a little bit).