title: Rewrite htaccess to nginx with http authorization
body: <p>I have a apache2 rewrite rule in .htaccess:</p>
  
  <pre><code>RewriteRule ^down.pl down.pl [E=HTTP_AUTHORIZATION:%{HTTP:AUTHORIZATION},L,QSA]
  </code></pre>
  
  <p>Please, how to rewrite it for nginx?</p>
  
  <p>My nginx code looks like:</p>
  
  <pre><code>setenv HTTP_AUTHORIZATION:$http_authorization;
  rewrite ^/down.pl /down.pl last;
  </code></pre>
  
  <p>But it doesn't work, I cannot start nginx server at all due error.</p>
  
  <p>Config:</p>
  
  <pre><code>server {
      listen   80;
      server_name www.example.tld example.tld;
      root /srv/!example.tld/!www;
  
      index  desktop.pl index.html index.htm core.tom core.pl;
  
      location / {     
          setenv HTTP_AUTHORIZATION:$http_authorization;
          rewrite ^/down.pl /down.pl last;
      }
  
      location ~ \.pl|cgi|tom$ {
          gzip off;
          include /etc/nginx/fastcgi_params;
          fastcgi_pass unix:/var/run/fcgiwrap.socket;
          fastcgi_index index.pl;
          fastcgi_param SCRIPT_FILENAME /srv/!example.tld/!www$fastcgi_script_name;
      }
  }
  </code></pre>