 <p>That's not the strict solution to the issue. </p> <p>What's happening is that you have only one server block and it becomes the default server block for all requests, even the ones not matching the server name. You simply need to add a default server block in your configuration :</p> <pre><code>server { listen 80 default_server; } </code></pre> <p>By the way, you have a typo (semicolon before <code>permanent</code>) and you don't need a rewrite as you have specific regular expression. Use this instead :</p> <p><code>return 301 http://www.example.net$request_uri;</code></p>