It is generally recommended to avoid heavy exercise for 4 weeks, but it really depends on how you are feeling.
I tried some short duration jogging at about 2.5 weeks post op and it was fine. Strength training that does not involve upper arms such as biceps concentration curls or leg curls caused me no pain.
I tried some push ups at around 3 weeks post op and those hurt, so I did not do any chest or back exercise or anything exercise that may stretch my upper-body until around 6 weeks post op.
I felt some sharp pain in my lower ribs when I ran 4-6 weeks post op I was not sure if it was from surgery since the location was below my incision line. I switched my cardio to spinning which did not cause so much impact and the pain went away.
So in general, I think you can start exercise carefully when you feel like it, but do not drive yourself too hard. If you eat a balanced diet and keep active by walking around and mild exercises, you will NOT lose your gains by taking 1-2 months off from gym.