Eye infections are caused by a virus or bacteria in the environment that attacks the eye. The most common of these infections is conjunctivitis, commonly known as pink eye. An eye infection can happen in almost any part of the eye, such as the eyelid (blepharitis), the vitreous (vitritis), the optic nerve (neuroretinitis) and the cornea (keratitis).