  We obtain a universal energy estimate up to the boundary for stable solutions
of semilinear equations with variable coefficients. Namely, we consider
solutions to $- L u = f(u)$, where $L$ is a linear uniformly elliptic operator
and $f$ is $C^1$, such that the linearized equation $-L - f'(u)$ has
nonnegative principal eigenvalue. Our main result is an estimate for the
$L^{2+\gamma}$ norm of the gradient of stable solutions vanishing on the flat
part of a half-ball, for any nonnegative and nondecreasing $f$. This bound only
requires the elliptic coefficients to be Lipschitz. As a consequence, our
estimate continues to hold in general $C^{1,1}$ domains if we further assume
the nonlinearity $f$ to be convex. This result is new even for the Laplacian,
for which a $C^3$ regularity assumption on the domain was needed.
