This thesis investigates the dipole-dipole interactions of thermal atomic vapors that are confined by a planar surface or a nanocavity and subjected to near-resonant light. One focus is on the Casimir-Polder effect, an atom-wall interaction caused by thermal and quantum fluctuations. Furthermore, it is shown that the atom-atom interactions lead to density-dependent line shifts and broadenings beyond continuous electrodynamics models. They can be controlled by the properties of the nanocavity.<eng>