In my opinion and experience the best homemade carpet cleaning solution for getting carpets really clean is vinegar and water.
Mix one cup of white vinegar with two cups of water and add it to your carpet cleaning machine and the vinegar and water will do a wonderful job at naturally cleaning your carpet.
The vinegar will also get rid of odors as well in your carpet.
You can also add some baking soda to the carpet and let it sit overnight which will help to absorb even more odor and keep your carpets smelling fresh.
Mixing dish detergent with some water can also clean carpets naturally without the use of harsh chemicals.
Or another option for a homemade carpet cleaning solution is to mix some hydrogen peroxide in with some water in the carpet cleaning machine.
Hydrogen Peroxide is actually used in some commercially available carpet cleaning solutions.