Simplify template output

This PR simplifies and reduces the size of the template output by moving statements whose values don't differ per `server` or `location` block to the top level.

It also changes from dropping `Connection` to explicitly setting it to `close` in the non-`Upgrade` case.