We report the experimental realization of an optical trap that localizes single Cs atoms ~215 nm from surface of a dielectric nanofiber. By operating at magic wavelengths for pairs of counter-propagating red- and blue-detuned trapping beams, differential scalar light shifts are eliminated, and vector shifts are suppressed by ~250. We thereby measure an absorption linewidth Gamma/2pi = 5.7 pm 0.1 MHz for the Cs 6S1/2,F=4 - 6P3/2,F=5 transition, where Gamma/2pi = 5.2 MHz in free space. Optical depth d~66 is observed, corresponding to an optical depth per atom d_1~0.08. These advances provide an important capability for the implementation of functional quantum optical networks and precision atomic spectroscopy near dielectric surfaces.