Nginx: Improve the logic for config templates customization.