Infrared observations of the coma of 67P/Churyumov-Gerasimenko were carried out from July to September 2015, i.e., around perihelion (13 August 2015), with the high-resolution channel of the VIRTIS instrument onboard Rosetta. We present the analysis of fluorescence emission lines of H$_2$O, CO$_2$, $^{13}$CO$_2$, OCS, and CH$_4$ detected in limb sounding with the field of view at 2.7-5 km from the comet centre. Measurements are sampling outgassing from the illuminated southern hemisphere, as revealed by H$_2$O and CO$_2$ raster maps, which show anisotropic distributions, aligned along the projected rotation axis. An abrupt increase of water production is observed six days after perihelion. In the mean time, CO$_2$, CH$_4$, and OCS abundances relative to water increased by a factor of 2 to reach mean values of 32%, 0.47%, and 0.18%, respectively, averaging post-perihelion data. We interpret these changes as resulting from the erosion of volatile-poor surface layers. Sustained dust ablation due to the sublimation of water ice maintained volatile-rich layers near the surface until at least the end of the considered period, as expected for low thermal inertia surface layers. The large abundance measured for CO$_2$ should be representative of the 67P nucleus original composition, and indicates that 67P is a CO$_2$-rich comet. Comparison with abundance ratios measured in the northern hemisphere shows that seasons play an important role in comet outgassing. The low CO$_2$/H$_2$O values measured above the illuminated northern hemisphere are not original, but the result of the devolatilization of the uppermost layers.