In gas-oversaturated solutions, stable surface nanobubbles can exist thanks to a balance between the Laplace pressure and the gas overpressure, provided the contact line of the bubble is pinned. In this article, we analyze how the disjoining pressure originating from the van der Waals interactions of the liquid and the gas with the surface affects the properties of the surface nanobubbles. From a functional minimization of the Gibbs free energy in the sharp-interface approximation, we find the bubble shape that takes into account the attracting van der Waals potential and gas compressibility effects. Although the bubble shape slightly deviates from the classical one (defined by the Young contact angle), it preserves a nearly spherical-cap shape. We also find that the disjoining pressure restricts the aspect ratio (size/height) of the bubble and derive the maximal possible aspect ratio, which is expressed via the Young angle.