We study the spontaneous emission of atoms near an optical nanofiber and analyze the coupling efficiency of the spontaneous emission into a nanofiber. We also investigate the influence of the van der Waals interaction of atoms with the surface of the optical nanofiber on the spectrum of coupled light. Using, as an example, Rb-85 atoms we show that the van der Waals interaction may considerably extend the red wing of the spontaneous emission line and, accordingly, produce a well-defined asymmetry of the spontaneous emission spectrum coupled into an optical nanofiber