Yep magnesium is a supplement you can get at natural food stores or pharmacies and can help with preventing migraines. You'll probably need to take it about a month to see a difference if it helps. It helps some people. Another one that helps some is coenzyme-q10, again pharmacy and natural food stores, about a month before you see if it helps prevent or reduce severity of your migraines.
Coenzyme-q10 helps with mine so it's one I take daily.
For an otc painkiller I find ibuprofen is the most effective. Caffeine can help with ibuprofen. Ibuprofen immediately at the start of a migraine can do a lot, including non pain symptoms. Of course not as much as my migraine prescription abortative, but an otc has advantages. Do that's worth noting, frequently one of the otc pain relievers works much better than others when dealing with migraines, which varies person to person.