1) Get at least 160 minutes of aerobic exercise a week. More is better. Make sure you can easily monitor your heart rate to insure you stay in either the fat burning zone (60-70% your maximun heart rate [MHR]; MHR is 220 minus your age) or sugar (glucose) burning zone (70-85% you MHR).
2) Weight or resistance train at least 90 minutes a week. Make sure you do at least two reps or each kind where you go until it burns and then do TWO more.
When you're too inactive your body releases hormones that signal inflammation and decay, so you rot in pain (literally stew in you own juices). When you're active enough, your body releases hormones that trigger repair and growth, so you heal.
Caveat: WORK YOUR WAY UP TO THIS. If you can only do five minutes at a time, that's okay. But once you get there (above), try it for at least a month, preferably three. Like mediation, the benefitis require consistency over time.
Pain increases when the decay hormone levels are higher than the growth hormone levels.
More technically, during exercising the above ways your blood is flooded with decay hormones, but in order to "turn on" the repair and growth (pain-releiving!) hormones, you have to get your decay hormones at those high levels. And you can only get to those levels through aerobics and the burn of weight/resistance trainging.
3) Eat right (I know, this is very controversial, but try your best and avoid fad diets).