At least 21 people were killed in two separate Boko Haram attacks on villages near the key city of Maiduguri in northeast Nigeria, a community leader and a witness said on Friday.