Cover It Up
As green nitrogen-rich materials decompose, you may notice an ammonium odor coming from your compost pile. To prevent odors be sure to mix carbon-rich browns thoroughly into the pile and cover newly added greens with brown materials. By burying the greens with browns, you'll not only alleviate odors, you'll keep pests and flies from infesting your pile.
If you're composting indoors with worms, it's also important to cover their food with carbon materials such as shredded newspaper. To prevent rotting food odor, monitor the worms' intake. If they aren't eating everything you put in the container, feed them a little less.