My method may not be the best but it works for me to get my crosshairs level to the rifle, level to the ground. I use 2 inexpensive tiny "line" levels from Lowes for $4.
I first establish generally where I want the rings to sit on the upper, and generally where I want the scope to rest in the rings (front/aft) for my specific eye relief. Establish the ring location and fully install the rings to the upper and get that finished off and torqued down. Then play around with the scope loosely in the rigs and move it front/aft, under all the magnification levels to finalize where you want the scope to rest for your eye relief. Consider marking the scope tube with tape somewhere to temporarily mark the location (front/aft), just in case the scope moves while you put the rifle in a stationary position like a mag vise, etc.
Now level the rifle. Put one level on the upper just forward of the charging handle and get the rifle level front to back. Then reposition level 90 degrees and level the rifle right to left. Leave that level there and put the other level on a flat spot on top of the scope. Make sure scope hasn't moved and its in proper forward/aft location. Rotate scope accordingly to make it level. Now both levels should be level to the ground. Tighten up the rings and you're done. You should now have scope crosshairs that are for all practical purposes level to the rifle, which is level to the ground.