We calculate the nonlinear dipole and quadrupole moments induced at the second harmonic (SH) frequency 2ω in a dielectric nanosphere by an inhomogeneous monochromatic electric field of frequency ω. We neglect finite size effects and assume that the selvedge region of the nanosphere is thin enough so that the surface may be considered locally flat. Then, we calculate the nonlinear optical response of a centrosymmetric semiinfinite composite made by the nanospheres. Within the dipole approximation, SH is forbidden in the centrosymmetric bulk, but allowed at the surface of the composite where the symmetry is broken. Therefore, the components of the surface susceptibility tensor, χ ijk , different from zero are calculated. As an application, we evaluate χ ijk for a composite made of Si nanospheres.