In the context of quantization in string theory, the modern approach is the path integral/modern covariant quantization approach. As known from QFT, we fix our gauge and represent the arising Fadeev-Popov determinant through a Grassmann-integral with ghost variables $c_\beta$ and $b^{\alpha \beta}$ that are new fields of our theory, see for example the usual Tong.
In all cases of quantization, one finds that the modes of the energy-momentum tensor fulfill the Virasoro algebra (we neglect the normal ordering $a=1$ constant for simplicity) \begin{equation} [L^{(X)}_m,L^{(X)}_n] = (m-n) L^{(X)}_{m+n} + \frac{c^{(X)}}{12} m(m^2 - 1) \delta_{m+n,0}\,. \end{equation} The subscript will distinguish these generators from the ones we introduce in a moment. Namely, in modern covariant quantization one also gets an independent (slightly different) Virasoro algebra for generators $L_m^{(g)}$ built from the modes of our ghost fields, with corresponding central charge $c^{(g)}$. One then defines the total generator for both the Polyakov and the ghost action \begin{equation} L_m := L^{(X)}_m + L^{(g)}_m \end{equation} with central charge $c := c^{(X)} + c^{(g)}$. Now, as we have fixed our gauge, we should not have a Weyl anomaly, i.e. we demand that $c=0$ and as we can calculate $c^{(g)} = -26$, one gets the usual $c^{(X)} = 26$. The vanishing central charge then of course means that the total system does only transform under the Witt algebra.
We also demand that the other quantizations "produce" no Weyl anomaly, i.e. that our gauge redundancies are not broken through quantization, i.e. again $c=0$. My, probably rather simple, question now is how this was/is ensured in old covariant or light-cone quantization, without the use of ghosts, i.e. $c=c^{(X)}$. Do we necessarily need ghosts? The literature I have looked through always only demands a vanishing central charge when later discussing modern covariant quantization, but this may be due to a lack of research or understanding on my side.