The first step in conquering a gnat problem is to determine what the gnats are attracted to and remove it or make it unappealing. Locating and removing the gnats' food source is also important.
Oftentimes, wet soil in plants will provide a breeding ground for fungus gnats. Allowing the soil to dry completely between watering can help, and the lack of water will kill fungus gnat larvae in the soil.
Trash receptacles can attract gnats. Securing trash so that gnats cannot gain access is vital to eliminating the gnat population around your home, as items discarded can be attractive to gnats or even provide a source of food for them.