  We study the optical excitation spectrum of an atom in the vicinity of a
dielectric surface. We calculate the rates of the total scattering and the
scattering into the evanescent modes. With a proper assessment of the
limitations, we demonstrate the portability of the flat-surface results to an
experimental situation with a nanofiber. The effect of the surface-induced
potential on the excitation spectrum for free-to-bound transitions is shown to
be weak. On the contrary, the effect for bound-to-bound transitions is
significant leading to a large excitation linewidth, a substantial negative
shift of the peak position, and a strong long tail on the negative side and a
small short tail on the positive side of the field--atom frequency detuning.
