What are cases when Galois cohomology groups are given by étale cohomology?

Example: $S = Spec(K)$ the spectrum of a field, $F \in Sh(K)$, then $H^p(K, F) = H^p(G_K, F_{\bar{K}})$.

What if $G = \pi_1(X)$ and $F \in Sh(X)$? Under what conditions do we have $H^p(X, F) = H^p(G, [F])$, where $[F]$ denotes a suitable $\pi_1(X)$-module associated with $F$? (Example for this: $X = Spec(O_K)\setminus S$)