Hexagonal GaN epilayer grown on sapphire substrate by metal organic chemical vapour deposition (MOCVD) is studied using Raman scattering and photoluminescence in a temperature range from 100 K to 873 K. The model of strain (stress) induced by the different lattice parameters and thermal coefficients of epilayer and substrate as a function of temperature is set up. The frequency and the linewidth of Ehigh2 mode in a GaN layer are modelled by a theory with considering the thermal expansion of the lattice, a symmetric decay of the optical phonons, and the strain (stress) in the layer. The temperature-dependent energy shift of free exciton A is determined by using Varshni empirical relation, and the effect of strain (stress) is also investigated. We find that the strain in the film leads to a decreasing shift of the phonon frequency and an about 10meV-increasing shift of the energy in a temperature range from 100 K to 823 K.