title: Override location directives in nginx not working
body: <p>I want to override the permissions to <code>/folder/script.php</code> and have the following rules:</p>
  
  <pre><code> location ^~ /folder/script.php{
      allow all;
    }              #shouldn't ^this one with ^~ override the others?
  
   location ~ /folder/(.+)\.php$ {
    deny all;
    return 404;
    allow 127.0.0.1;
   }
  
    location ~ ^/folder {
      return 404;
    }
  
  location / {
  
          # First attempt to serve request as file, then
          # as directory, then trigger 404
          try_files $uri $uri/ =404;
          server_name_in_redirect off;        
  
  }
  
  location ~ \.php$ {
          try_files $uri =404;
  
          #fastcgi_split_path_info ^(.+\.php)(/.+)$;
          # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
  
          #fastcgi_pass /tmp/php5-fpm.sock;
          #fastcgi_pass /var/run/php5-fpm.sock;
          fastcgi_pass 127.0.0.1:9000;
  
             fastcgi_index index.php;  
  
          fastcgi_param SCRIPT_FILENAME   $root_folder$fastcgi_script_name;
          fastcgi_param DOCUMENT_ROOT $root_folder;
  
          # send bad requests
          fastcgi_intercept_errors on;
  
          include fastcgi_params;
      }
  </code></pre>
  
  <p>but whenever I access admin.php I still get a 404 error and/or the script.php file is served to download, not interpreted. Could someone explain me why? Tyvm</p>