Moved some functions, changed the nginx config template.