Usually, I make a pit in the ground and surround it with rocks. I make sure the area around the fire pit is cleared of any materials that could catch on fire. I keep my fire low and don't create a bonfire which with a bit of wind could turn into a wildfire. I use a heavy-duty cooking screen that stays in place for placing pots or my tiny tea kettle on it, which also controls sparks from flying.
When leaving I let the fire burn down and put dirt on top first and then water the area down really well, making sure the fire is completely out. I think the biggest mistakes some folks make is making the fire bigger than needed and not paying attention to weather conditions like windy days, and leaving dried materials to close to the fire, and lastly not making sure the fire and hot coals are completely put out.
Many times I have been at campgrounds where campers have a huge fire going in the metal enclosed pit and leave it unattended for long periods of time. These campsites are not located near a water source so putting out a escaped wildfire is not an easy task. Just follow Smoky The Bear, and leave the forest green instead of charcoal burnt black.