Correct policy for modifying server blocks in nginx with EE4 and nginx proxy


I have now successfully configured my site ( with EE4 and letsencrypt. It has not been the smoothest process since I have to do some manual configuration. The original EE4 installation did not really fix all the necessary settings when I deployed my wp-backup.

Now I’m faced with some optimizing tweaks. According to, my https www is not redirecting to my https non-www as I have configured in my nginx settings at:


I’m suspecting that this is a nginx-proxy issue and that I need to set the server blocks in another location as well. As it is now my main nginx configuration is in


To avoid 503 error I also have in


Where should I put my nginx server blocks as well to get the redirection from to to work as it should?