This thesis reports on major steps towards the realization of scalable quantum networks. It addresses the experimental implementation of a deterministic interaction mechanism between flying optical photons and a single trapped atom. In particular, it demonstrates the nondestructive detection of an optical photon. To this end, single rubidium atoms are trapped in a three-dimensional optical lattice at the center of an optical cavity in the strong coupling regime. Full control over the atomic state — its position, its motion, and its electronic state — is achieved with laser beams applied along the resonator and from the side. When faint laser pulses are reflected from the resonator, the combined atom-photon state acquires a state-dependent phase shift. In a first series of experiments, this is employed to nondestructively detect optical photons by measuring the atomic state after the reflection process. Then, quantum bits are encoded in the polarization of the laser pulse and in the Zeeman state of the atom. The state-dependent phase shift mediates a deterministic universal quantum gate between the atom and one or two successively reflected photons, which is used to generate entangled atom-photon, atom-photon-photon, and photon-photon states out of separable input states.