The presence of macroscopic objects, like mirrors or cavity walls, changes the mode structure of the electromagnetic field. As a consequence, the vacuum fluctuations are also changed and they become position-dependent. This effect manifests itself in the appearance of the Casimir force, Casimir-Polder force, position-dependent energy shift and modified spontaneous emission. Also, the measurement of the electron magnetic moment is influenced by the cavity formed by the electrodes of the Penning trap.