Solution (source code)

= Solution

Choose $0<r<\operatorname{dist}(x,\partial\Omega)$. Differentiating the ball mean-value formula with respect to its centre and then using the <divergence theorem> gives
$$
D_i u(x)=\frac1{|B_r|}\int_{B_r(x)}D_i u(y)\,dy
=\frac1{|B_r|}\int_{\partial B_r(x)}u(y)\nu_i(y)\,dS_y.
$$
Consequently the <interior derivative estimate for a harmonic function> yields
$$
|\nabla u(x)|\leq \frac{C_n}{r}\sup_{B_r(x)}|u|
\leq \frac{C_n}{r}\sup_\Omega|u|.
$$
The constant may depend on $x$ and its distance from the boundary, but it is independent of $u$.