"What is the meaning of life?" is the most famous question in philosophy and the one philosophers most often refuse to take at face value. Pressed for an answer, most will first take apart the question.
Are you asking what life is for (a teleological question — what's the purpose)? Are you asking what makes a life worth living (an evaluative question — what's the good)? Are you asking what role you should play in your own life (an existential question — what to do)? Each has different answers.
Some traditions give clean teleological answers: serve God, achieve enlightenment, perpetuate the species. Modern philosophers tend toward humbler positions: meaning isn't something the universe hands you, it's something you and the people you care about construct. Susan Wolf's "fitting fulfillment" view is one of the more durable: a meaningful life is one in which you're actively engaged in projects that have genuine value, and the engagement and the value both matter.
Maybe the question's hardest move is realizing it's not one question. Asking for "the meaning of life" is like asking for "the meaning of music" — you can answer for a particular piece, in a particular moment, for a particular listener. The general version dissolves into the specifics.