A very common practice when nailing, particularly during the construction of walls, floors, and ceilings, is called "toenailing." Toenailing is a technique of driving nails at an angle when you can’t simply nail through the face of one board into another.
To toenail properly, drive a nail at approximately 30 degrees through the end of one board into the face of the other.
The illustration shows how this technique works when nailing the bottom of a wall stud to the base plate in wall construction. In the case shown here, two nails are driven from each side, placed where they won't bump into one another.