title: Simple nginx redirect doesn't match
body: <p>I was originally trying to do a complicated URL rewrite which I couldn't get working, so stripped it back to a simple URL redirect which should definitely work, instead it throws a 404.</p>
  
  <p>Requests for [any_scheme]://www.mydomain.com/google should redirect to <a href="https://www.google.com/" rel="nofollow noreferrer">https://www.google.com/</a></p>
  
  <p>nginx.conf
  (not posted as it contains no server blocks so can't conflict?)</p>
  
  <p>mydomain.com.conf:</p>
  
  <pre><code>server {
      server_name www.mydomain.com;
      root /home/mydomain/public_html;
      index index.php index.html index.htm;
  
      listen 80;
      listen [::]:80;
      listen 443 ssl;
      listen [::]:443 ssl;
  
      ssl_certificate /home/mydomain/ssl.combined;
      ssl_certificate_key /home/mydomain/ssl.key;
  
      access_log /var/log/virtualmin/mydomain.com_access_log;
      error_log /var/log/virtualmin/mydomain.com_error_log;
  
      location ~ \.php$ {
          include snippets/fastcgi-php.conf;
          fastcgi_pass unix:/run/php/php7.2-fpm.sock;
      }
  
      location = /google {
          return 302 https://www.google.com/;
      }
  
      #rogue .htaccess files caught here
      location ~ /\.ht {
          deny all;
      }
  }
  
  #force non-www. to www.
  server {
      server_name mydomain.com;
      listen 80;
      listen [::]:80;
      listen 443 ssl;
      listen [::]:443 ssl;
      return 301 $scheme://www.mydomain.com$request_uri;
  }
  </code></pre>