I have the following nginx configuration fragment:
server { listen 80; server_name mydomain.io; root /srv/www/domains/mydomain.io; index index
According to https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/#server-name-if, you should use:
server { server_name www.example.com; return 301 $scheme://example.com$request_uri; } server { server_name example.com; # [...] }