Quantum light–matter interfaces connecting stationary qubits to photons will enable optical networks for quantum communications, precise global time keeping, photon switching and studies of fundamental physics. Rare-earth-ion-doped crystals are state-of-the-art materials for optical quantum memories and quantum transducers between optical photons, microwave photons and spin waves. Here we demonstrate coupling of an ensemble of neodymium rare-earth-ions to photonic nanocavities fabricated in the yttrium orthosilicate host crystal. Cavity quantum electrodynamics effects including Purcell enhancement (F=42) and dipole-induced transparency are observed on the highly coherent 4I9/2–4F3/2 optical transition. Fluctuations in the cavity transmission due to statistical fine structure of the atomic density are measured, indicating operation at the quantum level. Coherent optical control of cavity-coupled rare-earth ions is performed via photon echoes. Long optical coherence times (T2∼100 μs) and small inhomogeneous broadening are measured for the cavity-coupled rare-earth ions, thus demonstrating their potential for on-chip scalable quantum light–matter interfaces.