The theory of a closed bosonic string interacting with background fields, namely, with metric, antisymmetric tensor of second rank and dilaton, is considered. The classical formulation of the constrained theory is developed and the canonical quantization is carried out. The combined symbols of the Virasoro operators corresponding to the Weyl ordering of zero string modes and to the Wick ordering of oscillating ones are constructed. The quantum Virasoro algebra is formulated by means of star-commutators corresponding to these symbols and the nonlocal first quantum correction in the algebra is calculated. The local part of the correction linear in curvature is derived and effective equations of motion for background fields are obtained in the lowest order.