Fungus gnats are those annoying little mosquito like bugs that seem to invade our indoor plants from time to time. They don't bite and they tend to feed on dead plant material or fungus more so than live plant material, but they can be pesky just the same and it's pretty easy to get ride of them. The larvae look like tiny little white worms just below the soil surface. The adults tend to stay on top of the soil and you might see them fluttering around when you water your plants.
For the most part, they are attracted to moist soil and dead plant material, so reducing the amount you water and keeping dead foliage cleaned up will help prevent them from invading in the first place.
If you already have a fungus gnat problem, you may want to re-pot your plants to help remove the larvae that are in the soil. Try not to disturb the root ball too much and remove as much of the soil as you can. Putting a 1/2 layer of sand on top of the soil will help keep the top of the soil drier and therefore less attractive to them.
If re-potting is not an option, you can catch the larvae by putting a cut piece of potato on top of the soil. The larvae will be attracted to the potato and start feeding on it instead of the dead plant material in the pot. Check the potato daily and discard when you see larvae. Keep putting out a new piece of potato until you see no more larvae.
To catch adult gnats, set out yellow or blue sticky traps near the plants. This is not the most attractive method, so you can also drench the soil with pyrethrin which is an organic pesticide made from the chrysanthemum plant. This will kill the adults and many of the larvae as well.
Another option is sprinkling Bt (Bacillus thuringiensis) on the soil. Bt is a bacteria that kills caterpillars and larvae, so take care when using it around butterflies, but it is excellent for using indoors and will not harm children or pets when used as directed.
If fungus gnats are a problem in your greenhouse, you can plant pots of wheat to attract them to those plants instead of your prized plants. Once you see activity around the wheat plants, remove them and compost the plant and soil away from your plants. Replace those pots with new pots of wheat. Keep repeating the process as necessary. Since greenhouses tend to have a large number of plants in small area, this method works well with minimal effort on the gardener.