Let $X$ be compact Hausdorff topological space. Consider the ring $C(X)$ of continuous functions $X \rightarrow \mathbb C$ (we do not consider the C* algebra structure, just consider $C(X)$ as a ring) and its (purely algebraic) spectrum $\text{Spec}(C(X))$. There is a injective continuous map $X \rightarrow \text{Spec}(C(X))$ sending $x$ to the maximal ideal $\mathfrak m_x = \{f \in C(X) : f(x) = 0\}$. Under which conditions on $X$ is this map surjective? Under which conditions is it a homeomorphism to its image?