Why does the diffuser section generate thrust in a jet engine?
But why is the diffuser also providing forward thrust?


The diffuser slows down the flow to ease fuel-air mixing and combustion a bit later. If you only focus on entry and exit speeds, there would be no thrust.

However, if you look at the pressures on the diffuser walls, a different result emerges. Slower flow means higher static pressure, and the total pressure right at the compressor exit is already the highest within the whole engine. The pressure on those widening diffusor walls does indeed push the engine forward because of the forward slant of the pressure vector (which acts perpendicularly to the diffusor walls). Your linked pulse jet page explains this quite well.

Of course, no thrust would result if the flow were not heated and thus accelerated further downstream. So the diffuser all by itself will not create thrust; this happens only when it is placed inside a working jet engine.


  And also why the nozzle is providing rearward thrust?


This is not always the case, but here the nozzle has a converging shape which helps to accelerate the subsonic flow and converts the remaining pressure to speed. The walls now have a backward-facing slant, so the pressure vector on them will contribute a backward-facing component. In addition, the high flow speed along the large nozzle walls causes some friction, which needs to be considered, too.

For a comparison, look at the cone behind the turbine wheels. Its thrust contribution only stems from the forward-facing pressure acting on it.