Never use NSAIDs to treat pain unless absolutely necessary. They often end up causing more problems than they solve. Among other things they cause leaky gut. Studies have even shown that they often cause the headaches that they are being taken for.
First rule for pain elimination: Make sure you are drinking a cup of water (with minerals) for every 10 pounds of body weight everyday.
Eat plenty of fiber from fresh veggies and fruit and grains each day. (Aim for 35grams if you are actually counting.)
Vitamin C is great for healing and diminishing pain. Take a couple of grams every 30 to 60 minutes until pain subsides (or until you get a loose stool).
Eating whole eggs, real whole wheat, or coconut oil all help in easing pain as well.
Take 3 to 4 Tablespoons of coconut oil a day.
Remember that pain is your body communicating something. Don't just cover it up and ignore it. It usually means that you are doing something that the body doesn't like. Try to analyze what the problem might be.