What is the meaning of life?

In your opinion what is the meaning of life? Why are we put on this earth? Why are certain. People given certain challenges etc? I found out my best friends mom has cancer my son was just diagnosed with autism forget about my past there's no words to begin to describe that etc... I can't understand why these things are happening??? I've always been religious but I cannot understand for the life of me why horrible things need to happen? Interested in all answers religious not religious etc... tia!