2. If the distances from the center of the ellipse to the focus, to the vertex of the major axis, and to the directrix can form a right triangle, then the eccentricity of the ellipse is $\qquad$

保留源文本的换行和格式，直接输出翻译结果。
2. $\sqrt{\frac{\sqrt{5}-1}{2}}$.

From $c^{2}+a^{2}=\left(\frac{a^{2}}{c}\right)^{2} \Rightarrow c^{2}=a b$.
$$
\begin{array}{l}
\text { Also } c^{2}+b^{2}=a^{2} \Rightarrow a b+b^{2}=a^{2} \\
\Rightarrow \frac{a}{b}=\frac{\sqrt{5}+1}{2} .
\end{array}
$$

Thus, $a^{2}=a b \cdot \frac{a}{b}=c^{2} \cdot \frac{\sqrt{5}+1}{2}$.
Therefore, $e=\frac{c}{a}=\sqrt{\frac{\sqrt{5}-1}{2}}$.