The 2 main ways are by exposing your bare skin to sunlight and by taking Vit D supplements. You can't get the right amount of Vit D your body needs from food as most sources only have small amounts.
The most effective and natural way is by exposing your bare skin to sunlight (UVB rays). You don't need to tan or burn your skin to get Vit D but the more skin you expose the more Vit D is produced. For a fair-skinned person this could be 15 minutes, yet an hour may be required for a dark-skinned person. In fact, your body can produce 10,000 - 25,000 IU of Vit D in about the same amount of time it takes for your skin to start turning pink (not red!).
The amount of Vitamin D you make from exposing your bare skin depends on:
The time of day - you make more Vit D during the middle of the day
Where you live - the closer to the equator, the easier it is to produce Vit D all year round
How old you are - as you get older, skin finds it harder to produce Vit D
The colour of your skin - pale skin makes Vit D faster than darker skin
The amount of skin you expose - exposing your back will produce more Vit D than exposing your face.
If supplementation is required, or you have specific concerns about your levels, it is best to consult with your Naturopath or Integrative GP about the best type of Vit D, correct dose, problems with absorption, interaction with medications etc.