Move optional www redirect into lb nginx config

This was previously done badly in application server nginx for LPA,
the right place for it is at the border in the lb config.

I've tried to write this change in a way that will not cause
unnecessary nginx reloads - there should be no config file change
unless redirect_to_www is enabled.