The time dilation is due to a difference in the gravitational potential energy, so it is due to the difference in height. It doesn't matter whether the strength of the gravitational field varies, or how much it varies, all that matters is that the two observers comparing their clocks have a different gravitational potential energy.
To be more precise about this, when the gravitational fields are relatively weak (which basically means everywhere well away from a black hole) we can use an approximation to general relativity called the weak field limit. In this case the relative time dilation of two observers $A$ and $B$ is given by:
$$ \frac{dt_A}{dt_B} \approx \sqrt{ 1 + \frac{2\Delta\phi_{AB}}{c^2}} \approx 1 + \frac{\Delta\phi_{AB}}{c^2} \tag{1}$$
where $\Delta\phi_{AB}$ is the difference in the gravitational potential energy per unit mass between $A$ and $B$.
Suppose the distance in height between the two observers is $h$, then in a constant gravitatioinal field with acceleration $g$ we'd have:
$$ \Delta\phi_{AB} = gh $$
If this was on the Earth then taking into account the change in the gravitational potential energy with height we'd have:
$$ \Delta\phi_{AB} = \frac{GM}{r_A} - \frac{GM}{r_B} $$
where $r_A$ and $r_B$ are the distances of $A$ and $B$ from the centre of the earth and $M$ is the mass of the Earth. Either way when we substitute our value of $\Delta\phi_{AB}$ into equation (1) we're going to get a time dilation.
As for the accelerating rocket: the shortcut is to appeal to the equivalence principle. If acceleration is equivalent to a gravitational field then it must also cause a time dilation in the same way that a gravitational field does.
Alternatively we can do the calculation rigorously. The spacetime geometry of an accelerating frame is described by the Rindler metric, and we can use this to calculate the time dilation. The Rindler metric for an acceleration $g$ in the $x$ direction is:
$$ c^2d\tau^2 = \left(1 + \frac{gx}{c^2}\right)^2c^2dt^2 - dx^2 - dy^2 - dz^2 $$
We get the time dilation by setting $dx=dy=dz=0$ to give:
$$ c^2d\tau^2 = \left(1 + \frac{gx}{c^2}\right)^2c^2dt^2 $$
and on rearranging this gives:
$$ \frac{d\tau}{dt} = 1 + \frac{gx}{c^2} $$
which is just the equation (1) that we started with.