Does the gravity oppose to the Universe expansion? I'm trying to understanding the very basic of the current cosmology.
I searched in the old questions but I found nothing that answers specifically to my questions.

As far as I understand, we have to think the "expansion" more like a "streching" of the space that makes room for "new" space. This is confirmed because the Universe is homogeneous and non-local. 

First question: does the gravity contrast this expansion? In other words: does the space expand more in the areas with less gravity (i.e. among galaxies) and less in the nearby of stars and planets?

If we imagine to place a ruler between two stars, say at 10 ly, it would "extend" over time - even if we will still read 10 ly, right? But if now we place another ruler that was kept in our (huge) pocket, it will measure a longer distance. Is it correct?

That because the first ruler has expanded together the space between the stars, while the second one endured the force of gravity and was kept rolled up so it wasn't able to expand.
Expansion depends on the amount of mass

Yes, space expands more in regions with less matter — in fact this has been proposed as an alternative explanation to dark energy as the cause of the observed accelerated expansion: If by chance we happen to be located near the center of a "cosmic void", then nearby space expands faster than distant space, and since nearby space corresponds to recent times, this would be interpreted as recent accelerated expansion. This idea was popular some ten years ago (e.g. Conley et al. 2007; Wiltshire 2008), but isn't to my knowledge so hot anymore.

Similarly, in regions with more matter, space expands less. In fact, on scales as small as galaxies, and even galaxy groups, space doesn't expand at all. Gravity prevents galaxies from expanding, and keeps galaxies near each other from receding. On even smaller scales, electromagnetic (and nuclear) forces keeps objects like stars, planets, and bicycles from expanding.

Expansion is physical

For this reason, space between two stars doesn't expand. So, to address your question, let's consider instead two galaxies, separated by millions of light-years. However, fundamentally we cannot place a ruler between them and watch it expand. Electromagnetic forces would try to hold it together, fail, and the ruler would break.

Why is this? Imagine a rigid ruler, one megaparsec long (i.e. 3.26 million light-years). Since the Hubble constant is $H_0 \simeq 70\,\mathrm{km}\,\mathrm{s}^{-1}\,\mathrm{Mpc}^{-1}$, the region at the other end of the ruler recedes at $70\,\mathrm{km}\,\mathrm{s}^{-1}$. That is, space "drags" the two ends of the ruler away from each other at $70\,\mathrm{km}\,\mathrm{s}^{-1}$. If the ruler doesn't break, a local observer will see the end of the ruler whizzing by at high speeds.

Perhaps you might be able to construct a rod able to withstand this stress. If I were a solid state physicist I might be able to calculate the maximum possible length of a rod, given an optimal material, but I'm not. But the point is that, no matter what material you come up with it is not even practically impossible to make it arbitrarily long, but "theoretically" impossible. There is a fundamental limit to the length of a physical ruler, namely the length corresponding to the distance at which two regions of space recedes at the speed of light, i.e. $d = c/H_0 = 4400\,\mathrm{Mpc}$, or $14.4\,\mathrm{Glyr}$. If the ruler were longer than this and didn't break, then a local observer would see the end move by faster than the speed of light, which is not possible.

Luckily, there are other ways to measure distances, e.g. by "standard candles". And yes, if you measure the physical distance between the two galaxies at two different times, it will have increased in the meantime, physically.

(You could also imagine "freezing" space by magic, laying out 1-meter rods. In that case, second time you do it you will need more rods.)