We have developed a fiber-based confocal optical microscope that operates inside of a commercial scanning electron microscope (SEM) instrument (JEOL 6400; JEOL Ltd., Tokyo, Japan) enabling the excitation of a sample either by a laser or by electron beam, and hence combining the complimentary techniques of photoluminescence and cathodoluminescence. The instrument uses single-mode fibers that enter the SEM by vacuum feedthroughs. The illumination and collection fibers operate as effective pinholes providing, in combination with a microscope objective (NA = 0.3), high spatial resolution (~2 μm) and excellent collection efficiency. The high spatial resolution ensures that the light collected from the sample is in a region of optimal laser beam and electron beam overlap. The capabilities of this instrument are tested by experiments involving the excitation of europium ions in situ doped in GaN thin films.